Comparing version 1.1.0 to 1.2.0
14
index.js
@@ -13,4 +13,8 @@ module.exports = function(allopts) { | ||
} | ||
if(n == m) | ||
if(n == m) { | ||
if (o('spread')) | ||
return cb.apply(null, [null].concat(results)) | ||
else | ||
return cb(null, results) | ||
} | ||
@@ -33,4 +37,8 @@ _cb = cb | ||
results[i] = Array.prototype.slice.call(arguments) | ||
if (n === m && _cb) | ||
_cb(null, results) | ||
if (n === m && _cb) { | ||
if (o('spread')) | ||
_cb.apply(null, [null].concat(results)) | ||
else | ||
_cb(null, results) | ||
} | ||
} | ||
@@ -37,0 +45,0 @@ } |
{ | ||
"name": "multicb", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Simple way to aggregate multiple node-style callbacks", | ||
@@ -5,0 +5,0 @@ "dependencies": {}, |
@@ -41,2 +41,15 @@ # MultiCB | ||
}) | ||
// spread argument | ||
var done = multicb({ pluck: 1, spread: true }) | ||
doAsync(done()) | ||
doAsync(done()) | ||
doAsync(done()) | ||
done(function(err, a, b, c) { | ||
console.log(err) // => undefined | ||
console.log(a) // => 'foo' | ||
console.log(b) // => 'bar' | ||
console.log(c) // => 'baz' | ||
}) | ||
``` |
4637
7
132
54