promise.cb
transform an async function to callback style
Install
npm i promise.cb --save
API
const pcb = ;const cbFn = ;
Example
const pcb = ; { return 1} const fn2 = ; { return Promise;} const _fn1 = ;const _fn2 = ;const _fn3 = ;const cb = { ; console;}; ; // log 1; // log 2; // log 3
Changelog
See Also
Why
callbackify
looks good, but it's usingasyncFn.length
, so it's not working when usingco.wrap
catch(e => cb(e))
is not right, ifcb(e)
throws, it will only cause the promise reject, not throw error up
License
the MIT License http://magicdawn.mit-license.org