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:
authorRebecca Turner <me@re-becca.org>2017-07-07 00:32:48 +0300
committerRebecca Turner <me@re-becca.org>2017-07-11 01:47:47 +0300
commit9fe905c399d07a3c00c7b22035ddb6b7762731e6 (patch)
tree37bad42ff073e6ecad8697a2e819ee39ce93a1ad /lib/outdated.js
parentb2b03733f8cf8983892076d15b830b5913891adb (diff)
install: fix max callstack exceeded loops with links
PR-URL: https://github.com/npm/npm/pull/17652 Credit: @iarna Reviewed-By: @zkat
Diffstat (limited to 'lib/outdated.js')
-rw-r--r--lib/outdated.js13
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/outdated.js b/lib/outdated.js
index 7d5cfba86..3b3c34f76 100644
--- a/lib/outdated.js
+++ b/lib/outdated.js
@@ -42,17 +42,14 @@ var moduleName = require('./utils/module-name.js')
var output = require('./utils/output.js')
var ansiTrim = require('./utils/ansi-trim')
-function uniqName (item) {
- return item[0].path + '|' + item[1] + '|' + item[7]
-}
-
function uniq (list) {
+ // we maintain the array because we need an array, not iterator, return
+ // value.
var uniqed = []
- var seen = {}
+ var seen = new Set()
list.forEach(function (item) {
- var name = uniqName(item)
- if (seen[name]) return
- seen[name] = true
+ if (seen.has(item)) return
+ seen.add(item)
uniqed.push(item)
})
return uniqed