File: 02-leven.diff

package info (click to toggle)
node-yarnpkg 1.13.0-1%2Bdeb10u1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 93,036 kB
  • sloc: sh: 323; makefile: 19
file content (25 lines) | stat: -rw-r--r-- 797 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Description: Replace dependency on leven with fast-levenshtein.
 The latter is available as a Debian package.
Forwarded: not-needed
Author: Paolo Greppi <paolo.greppi@libpf.com>

--- a/src/cli/commands/run.js
+++ b/src/cli/commands/run.js
@@ -10,7 +10,7 @@
 import * as constants from '../../constants.js';
 
 const invariant = require('invariant');
-const leven = require('leven');
+const levenshtein = require('fast-levenshtein');
 const path = require('path');
 const {quoteForShell, sh, unquoted} = require('puka');
 
@@ -139,7 +139,7 @@
       let suggestion;
 
       for (const commandName in scripts) {
-        const steps = leven(commandName, action);
+        const steps = levenshtein.get(commandName, action);
         if (steps < 2) {
           suggestion = commandName;
         }