1
0
mirror of https://github.com/uetchy/namae.git synced 2025-08-20 18:08:11 +09:00

fix: normalize diacritics

This commit is contained in:
2020-02-11 17:57:10 +09:00
parent 73f39dd615
commit b953d4a07a
2 changed files with 8 additions and 2 deletions

View File

@@ -4,7 +4,10 @@ export function capitalize(text: string): string {
}
export function sanitize(text: string): string {
return text.replace(/[\s@+!#$%^&*()[\]./<>{}]/g, '');
return text
.replace(/[\s@+!#$%^&*()[\]./<>{}]/g, '')
.normalize('NFD')
.replace(/[\u0300-\u036f]/g, '');
}
export function upper(word: string): string {