node style callback uitl.
Why?!
Most of the CLI app I have made with node have a common pattern:
output(data, function(err, result) {
if (!err) {
console.log(result)
} else {
throw new Error(err);
}
});
Wanted to reduce it:
output(data, cb);
$ npm install --save call-back
var cb = require('call-back');
output(data, cb);
// ^ where output is a module that as node-style callback.
MIT © Hemanth.HM