-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev-autocomplete-country-input' of https://github.com/p…
…arlemonde/1village into dev-csv-defiLingAutocomplete-IndexAsterix
- Loading branch information
Showing
2 changed files
with
57 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,16 @@ | ||
// Normalise les chaînes de caractères et les compare pour retourner un boolean | ||
|
||
export const normalizeString = (data: string): string => { | ||
return data.normalize('NFD').replace(/[\u0300-\u036f]/g, ''); | ||
}; | ||
|
||
export const isNormalizedStringEqual = (str1: string, str2: string): boolean => { | ||
const strNorm1 = str1.normalize('NFD').replace(/[\u0300-\u036f]/g, ''); | ||
const strNorm2 = str2.normalize('NFD').replace(/[\u0300-\u036f]/g, ''); | ||
|
||
return strNorm1.toLocaleLowerCase() === strNorm2.toLocaleLowerCase(); | ||
}; | ||
|
||
// export const isNormalizedStringEqual = (str1: string, str2: string): boolean => { | ||
// return normalizeString(str1).toLocaleLowerCase() === normalizeString(str2).toLocaleLowerCase(); | ||
// }; |