1.0.2 • Published 7 years ago

promisify-f v1.0.2

Weekly downloads
9
License
CC0-1.0
Repository
github
Last release
7 years ago

promisify-f

Turns a function that returns a future into a function that returns a promise.

install

npm install promisify-f

example

const promisify = require('promisify-f')

const futureIncrement = (ms, n) => new Future((reject, resolve) => {
  setTimeout(() => {
    resolve(n + 1)
  }, ms)
})

const incrementAsync = promisify(futureIncrement)
incrementAsync(500, 7).then(console.log) //=> 8