topromise
1.0.2 • Public • Published toPromise
convert a function to promise
Installation
$ npm install toPromise
API
require('toPromise');
let func = function (a, cb) {
if (a > 0) {
cb (null, Math.sqrt (a));
}
else {
cb (Error ('a is less than 0'));
}
};
func.promise(this,a,b)
.then(function(result){
})
.catch(function(e){
});
License
MIT
Package Sidebar
Install
Weekly Downloads