summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/ignore-walk/index.js
diff options
context:
space:
mode:
authorMichael Perrotte <mike@npmjs.com>2019-10-29 13:03:29 -0400
committerMyles Borins <mylesborins@google.com>2019-10-30 16:20:34 -0400
commitefe31e791d0f71cf7d7964f89f249aafca025cde (patch)
tree1bf722c3921816b6cf548dc8144a587273077d27 /deps/npm/node_modules/ignore-walk/index.js
parentaf2a9a45a54eef456829b9e045688b6eeeef4af0 (diff)
downloadandroid-node-v8-efe31e791d0f71cf7d7964f89f249aafca025cde.tar.gz
android-node-v8-efe31e791d0f71cf7d7964f89f249aafca025cde.tar.bz2
android-node-v8-efe31e791d0f71cf7d7964f89f249aafca025cde.zip
deps: update npm to 6.12.1
PR-URL: https://github.com/nodejs/node/pull/30164 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Diffstat (limited to 'deps/npm/node_modules/ignore-walk/index.js')
-rw-r--r--deps/npm/node_modules/ignore-walk/index.js14
1 files changed, 9 insertions, 5 deletions
diff --git a/deps/npm/node_modules/ignore-walk/index.js b/deps/npm/node_modules/ignore-walk/index.js
index abfd9ece57..eec6851804 100644
--- a/deps/npm/node_modules/ignore-walk/index.js
+++ b/deps/npm/node_modules/ignore-walk/index.js
@@ -17,7 +17,7 @@ class Walker extends EE {
this.includeEmpty = !!opts.includeEmpty
this.root = this.parent ? this.parent.root : this.path
this.follow = !!opts.follow
- this.result = this.parent ? this.parent.result : []
+ this.result = this.parent ? this.parent.result : new Set()
this.entries = null
this.sawError = false
}
@@ -31,8 +31,12 @@ class Walker extends EE {
if (!(this.sawError && ev === 'error')) {
if (ev === 'error')
this.sawError = true
- else if (ev === 'done' && !this.parent)
- data = data.sort(this.sort)
+ else if (ev === 'done' && !this.parent) {
+ data = Array.from(data)
+ .map(e => /^@/.test(e) ? `./${e}` : e).sort(this.sort)
+ this.result = data
+ }
+
if (ev === 'error' && this.parent)
ret = this.parent.emit('error', data)
else
@@ -57,7 +61,7 @@ class Walker extends EE {
this.entries = entries
if (entries.length === 0) {
if (this.includeEmpty)
- this.result.push(this.path.substr(this.root.length + 1))
+ this.result.add(this.path.substr(this.root.length + 1))
this.emit('done', this.result)
} else {
const hasIg = this.entries.some(e =>
@@ -145,7 +149,7 @@ class Walker extends EE {
const abs = this.path + '/' + entry
if (!st.isDirectory()) {
if (file)
- this.result.push(abs.substr(this.root.length + 1))
+ this.result.add(abs.substr(this.root.length + 1))
then()
} else {
// is a directory