Closed Dentosal closed 6 years ago
This is a rad feature @Dentosal, thanks for your contribution! I'll give this a review sometime during the long-weekend.
@helior Any problems with this? Feel free to ask if there are any issues.
@Dentosal no issue with these changes, other than the current merge conflicts; also, I haven't tested this locally. If you want to make the updates I'll merge when they're ready, otherwise I'll have to put some time aside to button this up and get it merged. A lot of people will appreciate this contribution, thanks again!
@helior I've rebased @Dentosal's changes on top of the current master (with some commit squashing/splitting), and tested the result with our app. I left normalize
as is - if you need IE11 support, you can use a polyfill for that.
@helior Is there something you'd like to see changed before merging this?
Sorry to introduce two changes in the same PR. I also fixed some deprecation warnings with React by moving to
React.createElement
style. If this is a real problem, feel free to either modify it yourself or ask me to do it in comments.This PR adds two props:
ignoreDiacritics
anddiacriticsBlacklist
. The code uses unicode normalization to separate and combine diacritical marks from characters.ignoreDiacritics
ignoreDiacritics
allows ignoring diacritical marks when matching. For instancecafe
will matchcafé
andá
will matcha
. Currently both search and subject are simplified, so it is not possible to makeá
not matcha
, except when usingdiacriticsBlacklist
.diacriticsBlacklist
diacriticsBlacklist
contains a list of characters excluded from diacritics removal. For example:Will match
Cafe Ääkkönen
andcafé ääkkönen
but notcafe aakkonen
.