forEachAsync
Advanced tools
Comparing version 2.1.1 to 2.2.0
@@ -0,1 +1,2 @@ | ||
/*jshint strict:true node:true es5:true onevar:true laxcomma:true laxbreak:true*/ | ||
(function () { | ||
@@ -6,17 +7,32 @@ "use strict"; | ||
function forEachAsync(arr, callback) { | ||
var sequence = Sequence(); | ||
function handleItem(item, i, arr) { | ||
var seq = this | ||
; | ||
function handleItem(item, i, arr) { | ||
sequence.then(function (next) { | ||
callback(next, item, i, arr); | ||
}); | ||
function nextItem(next, BREAK) { | ||
if (forEachAsync.BREAK === BREAK) { | ||
process.nextTick(function () { | ||
next(forEachAsync.BREAK); | ||
}); | ||
return; | ||
} | ||
seq._contextCallback.call(this, next, item, i, arr); | ||
} | ||
arr.forEach(handleItem); | ||
seq.then(nextItem); | ||
} | ||
function forEachAsync(arr, callback, _context) { | ||
var sequence = Sequence.create(_context); | ||
sequence._contextCallback = callback; | ||
arr.forEach(handleItem, sequence); | ||
return sequence; | ||
} | ||
forEachAsync.BREAK = '__forEachAsync_BREAK__'; | ||
module.exports = forEachAsync; | ||
}()); |
{ | ||
"name": "forEachAsync", | ||
"version": "2.1.1", | ||
"version": "2.2.0", | ||
"description": "The forEachAsync module of FuturesJS (Ender.JS and Node.JS)", | ||
@@ -17,3 +17,3 @@ "homepage": "https://github.com/coolaj86/futures", | ||
"dependencies": { | ||
"sequence": ">= 2.1.1" | ||
"sequence": ">= 2.2.1" | ||
}, | ||
@@ -20,0 +20,0 @@ "engines": { |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
2518
3
27
0
47
0
1
Updatedsequence@>= 2.2.1