Skip to content

Commit

Permalink
fix(utilities): check if the normalize function exists
Browse files Browse the repository at this point in the history
  • Loading branch information
mcallegario committed Feb 15, 2022
1 parent b37bce6 commit 00c1c92
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/common/src/services/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,7 @@ export function parseUtcDate(inputDateString: any, useUtc?: boolean): string {
* @returns
*/
export function removeAccentFromText(text: string, shouldLowerCase = false) {
const normalizedText = text?.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
const normalizedText = (typeof text.normalize === 'function') ? text.normalize('NFD').replace(/[\u0300-\u036f]/g, '') : text;
return shouldLowerCase ? normalizedText.toLowerCase() : normalizedText;
}

Expand Down

0 comments on commit 00c1c92

Please sign in to comment.