topromise

1.0.2 • Public • Published

toPromise

convert a function to promise

NPM version

Installation

$ npm install toPromise

API

require('toPromise');
 
 
let func = function (a, cb) {
    if (> 0) {
        cb (null, Math.sqrt (a));
    }
    else {
        cb (Error ('a is less than 0'));
    }
};
 
func.promise(this,a,b)
    .then(function(result){
        //TODO:...
    })
    .catch(function(e){
        //TODO:...
    });
 

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i topromise

Weekly Downloads

3

Version

1.0.2

License

MIT

Last publish

Collaborators

  • matrixdom