Ignore diacritics in autocomplete

Works for:
- Choice
- Choice List
- Reference
- Reference List

Co-Authored-By: Louis Delbosc <louis.delbosc.prestataire@anct.gouv.fr>
This commit is contained in:
Ronan Amicel
2022-08-09 15:43:44 +02:00
parent 103c795aa2
commit 2a05d04e35
6 changed files with 22 additions and 11 deletions

View File

@@ -55,6 +55,11 @@ export function capitalizeFirstWord(str: string): string {
return str.replace(/\b[a-z]/i, c => c.toUpperCase());
}
// Remove diacritics (accents and other signs).
export function removeDiacritics(text: string): string {
return text.normalize("NFKD").replace(/[\u0300-\u036f]/g, "")
}
// Returns whether the string n represents a valid number.
// http://stackoverflow.com/questions/18082/validate-numbers-in-javascript-isnumeric
export function isNumber(n: string): boolean {