Skip to content

Commit

Permalink
refactor: Switch to "fastest-levenshtein"
Browse files Browse the repository at this point in the history
  • Loading branch information
medikoo committed Sep 15, 2020
1 parent 7e32994 commit 0cd9cca
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/utils/getCommandSuggestion.js
@@ -1,7 +1,7 @@
'use strict';

const _ = require('lodash');
const levenshtein = require('fast-levenshtein');
const { distance: getDistance } = require('fastest-levenshtein');

const getCollectCommandWords = (commandObject, commandWordsArray) => {
let wordsArray =
Expand All @@ -20,7 +20,7 @@ const getCommandSuggestion = (inputCommand, allCommandsObject) => {
const commandWordsArray = getCollectCommandWords(allCommandsObject);
let minValue = 0;
commandWordsArray.forEach(correctCommand => {
const distance = levenshtein.get(inputCommand, correctCommand);
const distance = getDistance(inputCommand, correctCommand);
if (minValue === 0) {
suggestion = correctCommand;
minValue = distance;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -41,7 +41,7 @@
"decompress": "^4.2.1",
"download": "^8.0.0",
"essentials": "^1.1.1",
"fast-levenshtein": "^2.0.6",
"fastest-levenshtein": "^1.0.12",
"filesize": "^6.1.0",
"fs-extra": "^8.1.0",
"get-stdin": "^8.0.0",
Expand Down

0 comments on commit 0cd9cca

Please sign in to comment.