Skip to content

Commit

Permalink
fix: replace Diactric.js with remove-accents (#58)
Browse files Browse the repository at this point in the history
Closes #57

BREAKING CHANGE: We changed the diacritics library. No API changes, but there may be some behavioral changes with diacritics.
  • Loading branch information
glebtv authored and Kent C. Dodds committed Apr 17, 2019
1 parent 22f1d73 commit fa454c5
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
23 changes: 16 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"name": "match-sorter",
"version": "0.0.0-semantically-released",
"description":
"Simple, expected, and deterministic best-match sorting of an array in JavaScript",
"description": "Simple, expected, and deterministic best-match sorting of an array in JavaScript",
"main": "dist/match-sorter.cjs.js",
"jsnext:main": "dist/match-sorter.esm.js",
"module": "dist/match-sorter.esm.js",
Expand All @@ -19,7 +18,9 @@
"setup": "npm install && npm run validate",
"precommit": "kcd-scripts precommit"
},
"files": ["dist"],
"files": [
"dist"
],
"keywords": [
"autocomplete",
"filter list",
Expand All @@ -29,17 +30,25 @@
],
"author": "Kent C. Dodds <[email protected]> (http://kentcdodds.com/)",
"license": "MIT",
"bundledDependencies": ["diacritic"],
"bundledDependencies": [
"remove-accents"
],
"dependencies": {
"diacritic": "0.0.2"
"remove-accents": "0.4.2"
},
"devDependencies": {
"kcd-scripts": "^0.38.1"
},
"eslintConfig": {
"extends": ["./node_modules/kcd-scripts/eslint.js"]
"extends": [
"./node_modules/kcd-scripts/eslint.js"
]
},
"eslintIgnore": ["node_modules", "coverage", "dist"],
"eslintIgnore": [
"node_modules",
"coverage",
"dist"
],
"repository": {
"type": "git",
"url": "https://github.com/kentcdodds/match-sorter.git"
Expand Down
4 changes: 4 additions & 0 deletions src/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,10 @@ const tests = {
],
output: [{name: 'Jen', color: 'Red'}],
},
'case insensitive cyrillic match': {
input: [['Привет', 'Лед'], 'л'],
output: ['Лед'],
},
}

Object.keys(tests).forEach(title => {
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @copyright (c) 2017 Kent C. Dodds
* @author Kent C. Dodds <[email protected]>
*/
import diacritics from 'diacritic'
import removeAccents from 'remove-accents'

const rankings = {
CASE_SENSITIVE_EQUAL: 9,
Expand Down Expand Up @@ -366,7 +366,7 @@ function sortRankedItems(a, b) {
function prepareValueForComparison(value, {keepDiacritics}) {
value = `${value}` // toString
if (!keepDiacritics) {
value = diacritics.clean(value)
value = removeAccents(value)
}
return value
}
Expand Down

0 comments on commit fa454c5

Please sign in to comment.