1.0.4 • Published 9 years ago
promise-handler v1.0.4
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);
});