diff --git a/package-lock.json b/package-lock.json index 263769291..026d7a01b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7374,6 +7374,11 @@ "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=" }, + "fastest-levenshtein": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.9.tgz", + "integrity": "sha512-8DIQrqkmGTMfjcwiebj28Y1l6eCoLCU+TppdZa5zp5ZyNO12oUhtEEeCZjojZZarD8+peRg3CxL4Zm5BrKr9Fw==" + }, "fastq": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.6.0.tgz", @@ -11726,7 +11731,8 @@ "leven": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", - "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==" + "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", + "dev": true }, "levenary": { "version": "1.1.1", diff --git a/package.json b/package.json index 165b08c54..8cb2f5368 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,7 @@ "es6-promise": "^4.2.8", "escodegen": "^1.12.0", "estree-walker": "~0.9.0", + "fastest-levenshtein": "^1.0.9", "findup": "^0.1.5", "function.name-polyfill": "^1.0.6", "github-slugger": "^1.2.1", @@ -60,7 +61,6 @@ "jss-plugin-isolate": "^10.0.0", "jss-plugin-nested": "^10.0.0", "kleur": "^3.0.3", - "leven": "^3.1.0", "listify": "^1.0.0", "loader-utils": "^2.0.0", "lodash": "^4.17.15", diff --git a/src/scripts/utils/sanitizeConfig.ts b/src/scripts/utils/sanitizeConfig.ts index 5c6e8b8c9..2ee690de6 100644 --- a/src/scripts/utils/sanitizeConfig.ts +++ b/src/scripts/utils/sanitizeConfig.ts @@ -10,7 +10,7 @@ import isFinite from 'lodash/isFinite'; import map from 'lodash/map'; import listify from 'listify'; import kleur from 'kleur'; -import leven from 'leven'; +import { distance } from 'fastest-levenshtein'; import typeDetect from 'type-detect'; import loggerMaker from 'glogg'; import { stringify } from 'q-i'; @@ -57,7 +57,7 @@ export default function sanitizeConfig>( // Try to guess const possibleOptions = Object.keys(schema); const suggestedOption = possibleOptions.reduce((suggestion: string, option: string) => { - const steps = leven(option, key); + const steps = distance(option, key); if (steps < 2) { return option; }