Skip to content

Commit

Permalink
Added auto results object as a parameter to final callback.
Browse files Browse the repository at this point in the history
  • Loading branch information
eirikurn committed Mar 23, 2011
1 parent e8f5dd8 commit bb047d1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/async.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@
var results = {};
var keys = _keys(tasks);
if (!keys.length) {
return callback(null);
return callback(null, results);
}

var completed = [];
Expand All @@ -347,15 +347,15 @@

addListener(function () {
if (completed.length === keys.length) {
callback(null);
callback(null, results);
}
});

_forEach(keys, function (k) {
var task = (tasks[k] instanceof Function) ? [tasks[k]]: tasks[k];
var taskCallback = function (err, result) {
if (err) {
callback(err);
callback(err, results);
// stop subsequent errors hitting callback multiple times
callback = function () {};
}
Expand Down

0 comments on commit bb047d1

Please sign in to comment.