promise-handler

1.0.4 • Public • Published

A simple promise handler to use when you find yourself turning the same function (err, result) {} to promises again and again and again.

_Instead of:_​

return new Promise((resolve, reject) => {
    theLib.update(accountId, data, function(err, customer) {
        if (err) {
            return reject(err);
        }

        return resolve(customer);
    });
});

​_Do:_

return swear(handler => {
    theLib.accounts.update(accountId, data, handler);
});

Readme

Keywords

Package Sidebar

Install

npm i promise-handler

Weekly Downloads

0

Version

1.0.4

License

ISC

Last publish

Collaborators

  • peterhel