Is there an option to ignore accents ?
Example:
items: [{name: "R茅f茅rence"}, {name: "D茅nomination}]
If I search for reference, it won't find R茅f茅rence
Is this already possible?
Nb: it does work if you only have those two options, but with a large amount, it doesn't.
I'd recommend adding an extra key, and using speakingurl to normalize it (remove diacritics and such)
const getSlug = require('speakingurl')
// returns "Schoener Titel laesst gruessen!? Bel ete !"
let normalized = getSlug('Sch枚ner Titel l盲脽t gr眉脽en!? Bel 茅t茅 !', {
separator: ' ',
mark: true,
uric: true,
uricNoSlash: true,
maintainCase: true
})
@robozevel thanks for the advice, I can indeed to this!
However, wouldn't it be nice to have this built in ?
I'd be happy to work on this and make a PR.
@krisk would you accept a PR to add an option ignoring diacritics ?
actually an option to ignore any pattern would be super awesome as well
I solved this:
const removeSpecialCharacters = str => {
return str.normalize('NFD').replace(/[\u0300-\u036f]/g, '')
}
const list = suggestions.map(suggestion => ({
value: suggestion.value,
noSpecialCharacters: removeSpecialCharacters(suggestion.value)
}))
let opts = {
keys: ['value', 'noSpecialCharacters']
...
}
but I agree it could be a parameter. I will try to contribute to this if it is in your interest.
Definitely interesting to cover many languages. The default should be to not be accent-insensitive through to not introduce breaking changes
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days
Most helpful comment
I solved this:
but I agree it could be a parameter. I will try to contribute to this if it is in your interest.