/cb2promise

Converts whatever standard NodeJS callback function into ES6 standard promise.

Primary LanguageJavaScriptMIT LicenseMIT

This is a JavaScript version of the original cb2promise library. All coffeescript files have been transpiled and replaced by their JS counterparts.

This repo was created in a repsonse to an issue about using this library with webpack.

To replace the original coffeescript library with this JS one simply run:

npm install --save git+https://github.com/Maddoc42/cb2promise.git

cb2promise

Last version Dependency status Dev Dependencies Status NPM Status Donate

Converts whatever standard NodeJS callback function into ES6 standard promise.

Install

npm install cb2promise --save

If you want to use in the browser (powered by Browserify):

bower install cb2promise --save

and later link in your HTML:

<script src="bower_components/cb2promise/dist/cb2promise.js"></script>

Usage

var cb2promise = require('cb2promise');

var sampleFunction = function(done) {
  return done(null, 'hello world');
};

var promise = cb2promise(sampleFunction)

promise().then(console.log);
// => hello world

License

MIT © Kiko Beats