Skip to content

Commit 983cfe5

Browse files
committed
replace js-levenshtein with sift-string
1 parent 6cbd49a commit 983cfe5

File tree

3 files changed

+9
-18
lines changed

3 files changed

+9
-18
lines changed

package-lock.json

Lines changed: 6 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@
156156
},
157157
"devDependencies": {
158158
"@ctrl/tinycolor": "^3.1.0",
159-
"@types/js-levenshtein": "^1.1.0",
160159
"@types/mocha": "^5.2.0",
161160
"@types/moo": "^0.5.3",
162161
"@types/node": "^13.9.3",
@@ -175,7 +174,6 @@
175174
"globrex": "^0.1.2",
176175
"import-from": "^3.0.0",
177176
"jest": "^25.5.4",
178-
"js-levenshtein": "^1.1.6",
179177
"line-column": "^1.0.2",
180178
"mitt": "^1.2.0",
181179
"mkdirp": "^1.0.3",
@@ -186,6 +184,7 @@
186184
"resolve-from": "^5.0.0",
187185
"rimraf": "^3.0.2",
188186
"semver": "^7.3.2",
187+
"sift-string": "0.0.2",
189188
"stack-trace": "0.0.10",
190189
"terser": "^4.6.12",
191190
"tiny-invariant": "^1.1.0",

src/lsp/util/closest.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
import levenshtein from 'js-levenshtein'
1+
import sift from 'sift-string'
22

33
export function closest(input: string, options: string[]): string | undefined {
4-
return options.sort(
5-
(a, b) => levenshtein(input, a) - levenshtein(input, b)
6-
)[0]
4+
return options.concat([]).sort((a, b) => sift(input, a) - sift(input, b))[0]
75
}

0 commit comments

Comments
 (0)