Closed tunnckoCore closed 9 years ago
Problem is that index.js#L26 limit us. Currently that limit us to pass only one value to the callback e.g.
asyncDone(function (done) { done(null, 123); }, function(err, res) { console.log(res) //=> 123 })
but you cant
asyncDone(function (done) { done(null, 123, 456); }, function(err, res) { console.log(res) //=> 123 })
One way to fix it is to be 1:1 relation
asyncDone(function (done) { done(null, 123, 456); }, function(err, foo, bar) { console.log(foo) //=> 123 console.log(bar) //=> 456 })
to do it we should change done fn to this
done fn
function done(){ d.removeListener('error', onError); d.exit(); return cb.apply(null, arguments); }
Or other way is like .then do it - single array with values.
.then
asyncDone(function (done) { done(null, 123, 456); }, function(err, results) { console.log(results) //=> [123, 456] })
Im more for 1:1
/cc @phated ? as per https://github.com/tunnckoCore/benz
Published 1:1 in version 1.1.0
Problem is that index.js#L26 limit us. Currently that limit us to pass only one value to the callback e.g.
but you cant
One way to fix it is to be 1:1 relation
to do it we should change
done fn
to thisOr other way is like
.then
do it - single array with values.