Callbackify a promise function. The logical reverse of
thenify
.
npm install unthenify --save
Wrap a function that usually returns a promise to accept callbacks.
import { unthenify } from 'unthenify'
const handler = unthenify(async function (payload) {
// Do something...
return true
})
// Use with callback-style.
handler({}, function (err, result) {
console.log(err, result) //=> undefined, true
})
Apache 2.0