promisify-f

1.0.2 • Public • Published

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(+ 1)
  }, ms)
})
 
const incrementAsync = promisify(futureIncrement)
incrementAsync(500, 7).then(console.log) //=> 8

Package Sidebar

Install

npm i promisify-f

Weekly Downloads

6

Version

1.0.2

License

CC0-1.0

Last publish

Collaborators

  • m59