thunk2promise

0.1.0 • Public • Published

thunk2promise npmjs.com The MIT License

Transform or convert thunk to Bluebird Promise.

code climate standard code style travis build status coverage status dependency status

Install

npm i thunk2promise --save
npm test

Usage

For more use-cases see the tests

var thunk2promise = require('thunk2promise')
 
function thunk (a, b) {
  return function (cb) {
    if (=== b) {
      return cb(new Error('a === b'))
    }
    cb(null, a, b, 3)
  }
}
 
thunk2promise(thunk(333, 333)).catch(function (err) {
  console.error(err.message)
  //=> 'a === b'
})
thunk2promise(thunk(1, 2)).then(function (res) {
  console.log(res)
  //=> [1, 2, 3]
})

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
But before doing anything, please read the CONTRIBUTING.md guidelines.

Charlike Make Reagent new message to charlike freenode #charlike

tunnckocore.tk keybase tunnckocore tunnckoCore npm tunnckoCore twitter tunnckoCore github

Readme

Keywords

none

Package Sidebar

Install

npm i thunk2promise

Weekly Downloads

0

Version

0.1.0

License

MIT

Last publish

Collaborators

  • vanchoy
  • tunnckocore