summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dist/async.js20
1 files changed, 10 insertions, 10 deletions
diff --git a/dist/async.js b/dist/async.js
index f3cfb80..a0652f3 100644
--- a/dist/async.js
+++ b/dist/async.js
@@ -224,22 +224,22 @@
async.forEachOf =
async.eachOf = function (object, iterator, callback) {
callback = _once(callback || noop);
- object = object || [];
- var size = _isArrayLike(object) ? object.length : _keys(object).length;
- var completed = 0;
- if (!size) {
- return callback(null);
- }
- _each(object, function (value, key) {
+
+ var nextKey = _keyIterator(obj);
+ var key, running = 0;
+ while ((key = nextKey()) != null) {
+ running += 1;
iterator(object[key], key, only_once(done));
- });
+ }
+ if (!running) {
+ callback (null);
+ }
function done(err) {
if (err) {
callback(err);
}
else {
- completed += 1;
- if (completed >= size) {
+ if (--running) {
callback(null);
}
}