#53 - Ignoring diacritics

This commit is contained in:
Simon Cambier
2022-06-04 18:59:19 +02:00
parent f679f3bde9
commit ca808502eb
3 changed files with 31 additions and 2 deletions

View File

@@ -143,3 +143,10 @@ export function getAliasesFromMetadata(
.map(s => (s ? s.trim() : s))
.filter(s => !!s)
}
/**
* https://stackoverflow.com/a/37511463
*/
export function removeDiacritics(str: string): string {
return str.normalize('NFD').replace(/\p{Diacritic}/gu, '')
}