1.0.2 • Published 7 years ago
promisify-f v1.0.2
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