Closed MenesesEvandro closed 4 years ago
@MenesesEvandro I solved the problem like this:
const list = suggestions.map(suggestion => ({
value: suggestion.value,
noSpecialCharacters: stripDiacritics(suggestion.value)
}))
let opts = {
caseSensitive: false,
shouldSort: true,
threshold: accuracy,
keys: ['value', 'noSpecialCharacters']
}
export const stripDiacritics = str => {
return (
str && str.normalize && str.normalize('NFD').replace(/[\u0300-\u036f]/g, '')
)
}
Would be nice an option to ignore special character similar to case sensitive option.
"ç" would be replaced by "c", "é" by "e" and so on...