0.1.4 • Published 8 years ago

promise-cb v0.1.4

Weekly downloads
3,137
License
ISC
Repository
github
Last release
8 years ago

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);
});