Skip to content

use apply calling done #1

@tunnckoCore

Description

@tunnckoCore

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
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions