0.0.5 • Published 7 years ago

cbtp v0.0.5

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

toPromise

convert callback function to promise

Installation

$ npm install cbtp

API

const cbtp = require('cbtp');


function test (arg, callback) {
    if (arg > 0) {
        cb (null, arg*2);
    }
    else {
        cb (new Error ('arg is less than 0'));
    }
};

cbtp.toPromise(test,a)
    .then(function(result){
        //TODO:...
    })
    .catch(function(e){
        //TODO:...
    });

License

MIT

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago