-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
If promise returns array, it should pass every element of this array to different callback argument.
e.g.
function thunk (a, b) {
return function (cb) {
if (a === b) {
return cb(new Error('a === b'))
}
cb(null, a, b, 3)
}
}
var thunk2promise = require('thunk2promise')
var promise2thunk = require('promise2thunk')
var promise = thunk2promise(thunk(123, 456)).then(function (res) {
console.log(res) //=> [1, 2, 3]
return res
})
var thunk = promise2thunk(promise)
// currently it pass [1, 2, 3] array as second argument
thunk(function (err, one, two, three) {
console.log(one, two, three) //=> 1, 2, 3
})