Reorganise code - use src folder

This commit is contained in:
Timothy Armes
2023-10-11 14:05:27 +02:00
committed by Owen Rees
parent 2dc5f477c9
commit b5061b1c78
89 changed files with 70 additions and 69 deletions
+9
View File
@@ -0,0 +1,9 @@
export const removeDiacritics = (str: string) => {
// We normalize to the composed Unicode form, then we can remove the accents
return str.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
};
export const normalizedContains = (haystack: string, needle: string) => {
const regExp = new RegExp(removeDiacritics(needle), "gi");
return regExp.test(removeDiacritics(haystack));
};