Skip to content

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

Notifications You must be signed in to change notification settings

peterhel/promise-handler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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);
});

About

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

Resources

Stars

Watchers

Forks

Packages

No packages published