Package Exports
- cb2promise
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (cb2promise) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
cb2promise
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