0.1.2 • Published 7 years ago

promesify-js v0.1.2

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

Promesify

What is it?

This is a really simple and naive library that transforms a typical node asynchronous function into a promise.

Example:

fs.readdir('directory', (err, data) => {
  if(err){
    return console.log(err);
  }
  console.log(data);
});
// becomes
readdir('directory')
  .then(console.log)
  .catch(console.log)

Usage

import {promesify} from 'promesify-js';
const newFunction = promesify(yourAsyncFunction);
newFunction(all, your, args, except, the, callback)
  .then(console.log)
  .catch(console.log);