Comparing version 0.1.20 to 0.1.21
@@ -126,7 +126,7 @@ /*global setTimeout: false, console: false */ | ||
}; | ||
async.forEachLimit = function (arr, limit, iterator, callback) { | ||
callback = callback || function () {}; | ||
if (!arr.length || limit <= 0) { | ||
return callback(); | ||
return callback(); | ||
} | ||
@@ -136,28 +136,28 @@ var completed = 0; | ||
var running = 0; | ||
(function replenish () { | ||
if (completed === arr.length) { | ||
return callback(); | ||
} | ||
while (running < limit && started < arr.length) { | ||
iterator(arr[started], function (err) { | ||
if (err) { | ||
callback(err); | ||
callback = function () {}; | ||
} | ||
else { | ||
completed += 1; | ||
running -= 1; | ||
if (completed === arr.length) { | ||
callback(); | ||
} | ||
else { | ||
replenish(); | ||
} | ||
} | ||
}); | ||
started += 1; | ||
running += 1; | ||
} | ||
if (completed === arr.length) { | ||
return callback(); | ||
} | ||
while (running < limit && started < arr.length) { | ||
started += 1; | ||
running += 1; | ||
iterator(arr[started - 1], function (err) { | ||
if (err) { | ||
callback(err); | ||
callback = function () {}; | ||
} | ||
else { | ||
completed += 1; | ||
running -= 1; | ||
if (completed === arr.length) { | ||
callback(); | ||
} | ||
else { | ||
replenish(); | ||
} | ||
} | ||
}); | ||
} | ||
})(); | ||
@@ -164,0 +164,0 @@ }; |
@@ -5,3 +5,3 @@ { "name": "async" | ||
, "author": "Caolan McMahon" | ||
, "version": "0.1.20" | ||
, "version": "0.1.21" | ||
, "repository" : | ||
@@ -8,0 +8,0 @@ { "type" : "git" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
55983