npm.io
0.1.4 • Published 9 years ago

promise-cb

Licence
ISC
Version
0.1.4
Deps
0
Vulns
0
Weekly
0
Stars
4

Promise-CB

Promise-callback helper functions.

fromCallback

Creates a Promise from a callback-style function.

Example:

fromCallback(cb => fs.readFile(file, cb));

toCallback

Calls a callback function with the result of a promise once it settles.

Example:

toCallback(promise, (err, result) => {
  if (err) console.error(err.stack);
  else doSomething(result);
});