diff options
author | Forrest L Norvell <forrest@npmjs.com> | 2014-07-01 01:48:14 +0400 |
---|---|---|
committer | Forrest L Norvell <forrest@npmjs.com> | 2014-07-02 05:49:46 +0400 |
commit | 9ef8fe4d6ead3acb3e88c712000e2d3a9480ebec (patch) | |
tree | 16c9217730fcb030a4f1e63d1dbcd78fa1acfb5b /lib | |
parent | 63c3277f089b2c4417e922826bdc313ac854cad6 (diff) |
replace some.js with (Zalgo-safe) async-some@1.0.0
Diffstat (limited to 'lib')
-rw-r--r-- | lib/utils/gently-rm.js | 2 | ||||
-rw-r--r-- | lib/utils/some.js | 31 |
2 files changed, 1 insertions, 32 deletions
diff --git a/lib/utils/gently-rm.js b/lib/utils/gently-rm.js index 3571bd2bf..d43d0725e 100644 --- a/lib/utils/gently-rm.js +++ b/lib/utils/gently-rm.js @@ -12,7 +12,7 @@ var npm = require("../npm.js") , isInside = require("path-is-inside") , vacuum = require("fs-vacuum") , rimraf = require("rimraf") - , some = require("./some.js") + , some = require("async-some") function gentlyRm (path, gently, cb) { if (!cb) { diff --git a/lib/utils/some.js b/lib/utils/some.js deleted file mode 100644 index 6723b062f..000000000 --- a/lib/utils/some.js +++ /dev/null @@ -1,31 +0,0 @@ -module.exports = some - -/** - * short-circuited async Array.prototype.some implementation - * - * Serially evaluates a list of values from a JS array or arraylike - * against an asynchronous predicate, terminating on the first truthy - * value. If the predicate encounters an error, pass it to the completion - * callback. Otherwise, pass the truthy value passed by the predicate, or - * `false` if no truthy value was passed. - */ -function some (array, test, cb) { - var index = 0 - , length = array.length - - map() - - function map () { - if (index >= length) return cb(null, false) - - test(array[index], reduce) - } - - function reduce (er, value) { - if (er) return cb(er, false) - if (value) return cb(null, value) - - index++ - map() - } -} |