[Pkg-javascript-commits] [node-async] 183/480: update indentation on forEachSeries
Jonas Smedegaard
js at moszumanska.debian.org
Fri May 2 08:58:24 UTC 2014
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository node-async.
commit de143e13f9aa78c45c99822a1696bab76fc4e069
Author: Caolan McMahon <caolan at caolanmcmahon.com>
Date: Thu May 24 00:15:09 2012 -0700
update indentation on forEachSeries
---
lib/async.js | 54 +++++++++++++++++++++++++++---------------------------
1 file changed, 27 insertions(+), 27 deletions(-)
diff --git a/lib/async.js b/lib/async.js
index 3010bab..4a51d28 100644
--- a/lib/async.js
+++ b/lib/async.js
@@ -123,41 +123,41 @@
};
iterate();
};
-
+
async.forEachLimit = function (arr, limit, iterator, callback) {
callback = callback || function () {};
if (!arr.length || limit <= 0) {
- return callback();
+ return callback();
}
var completed = 0;
var started = 0;
var running = 0;
-
+
(function replenish () {
- if (completed === arr.length) {
- return callback();
- }
-
- while (running < limit && started < arr.length) {
- started += 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();
- }
- }
- });
- 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();
+ }
+ }
+ });
+ }
})();
};
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-async.git
More information about the Pkg-javascript-commits
mailing list