Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib/utils
diff options
context:
space:
mode:
Diffstat (limited to 'lib/utils')
-rw-r--r--lib/utils/did-you-mean.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/utils/did-you-mean.js b/lib/utils/did-you-mean.js
index 5e41af67a..98133196e 100644
--- a/lib/utils/did-you-mean.js
+++ b/lib/utils/did-you-mean.js
@@ -23,10 +23,11 @@ const didYouMean = async (npm, path, scmd) => {
const best = [...bestCmd, ...bestRun, ...bestBin]
- const suggestion = best.length === 0 ? ''
- : best.length === 1 ? `\n\nDid you mean this?\n${best[0]}`
+ if (best.length === 0)
+ return ''
+
+ const suggestion = best.length === 1 ? `\n\nDid you mean this?\n${best[0]}`
: `\n\nDid you mean one of these?\n${best.slice(0, 3).join('\n')}`
- const result = `Unknown command: "${scmd}"${suggestion}`
- return result
+ return suggestion
}
module.exports = didYouMean