Skip to content

Commit

Permalink
Normalize list items like the input value to allow matching umlauts (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmondok committed Dec 10, 2021
1 parent 2e08f6d commit fab606e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ alfy.matches = (input, list, item) => {
}

if (typeof listItem === 'string') {
listItem = listItem.toLowerCase();
listItem = listItem.toLowerCase().normalize();
}

if (typeof item === 'function') {
Expand Down
3 changes: 3 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,7 @@ test('.matches()', t => {

test('.inputMatches()', t => {
t.deepEqual(alfyInstance.inputMatches(['foo', 'unicorn']), ['unicorn']);
alfyInstance.input = 'Ünicörn';
t.deepEqual(alfyInstance.inputMatches(['foo', 'unicorn']), []);
t.deepEqual(alfyInstance.inputMatches(['foo', 'ünicörn']), ['ünicörn']);
});

0 comments on commit fab606e

Please sign in to comment.