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
diff options
context:
space:
mode:
Diffstat (limited to 'lib/utils/completion/installed-deep.js')
-rw-r--r--lib/utils/completion/installed-deep.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/utils/completion/installed-deep.js b/lib/utils/completion/installed-deep.js
index 243068861..590955a1e 100644
--- a/lib/utils/completion/installed-deep.js
+++ b/lib/utils/completion/installed-deep.js
@@ -1,5 +1,6 @@
const { resolve } = require('path')
const Arborist = require('@npmcli/arborist')
+const localeCompare = require('@isaacs/string-locale-compare')('en')
const installedDeep = async (npm) => {
const {
@@ -15,8 +16,7 @@ const installedDeep = async (npm) => {
return i
})
.filter(i => (i.depth - 1) <= depth)
- .sort((a, b) => a.depth - b.depth)
- .sort((a, b) => a.depth === b.depth ? a.name.localeCompare(b.name, 'en') : 0)
+ .sort((a, b) => (a.depth - b.depth) || localeCompare(a.name, b.name))
const res = new Set()
const gArb = new Arborist({ global: true, path: resolve(npm.globalDir, '..') })