Skip to content

Commit

Permalink
Add quotes to all font name strings
Browse files Browse the repository at this point in the history
  • Loading branch information
Vicente Canales committed Nov 15, 2023
1 parent 38e9d90 commit a236f49
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,20 +78,11 @@ export async function downloadFile( response ) {
}

/*
* Trim a string.
* @param {string} str The string to trim.
* @return {string} The trimmed string.
*/
export function trim( str ) {
str.trim();
}

/*
* Add quotes to fon name if it ends with a number.
* Add quotes to font name.
* @param {string} familyName The font family name.
* @return {string} The font family name with quotes if it ends with a number.
* @return {string} The font family name with quotes.
*/

export function addQuotesToName( familyName ) {
return trim( familyName.match( /\d$/ ) ? `'${ familyName }'` : familyName );
return `'${ familyName }'`.trim();
}

0 comments on commit a236f49

Please sign in to comment.