zoro
v0.5.0
Published
Async with like promise
Downloads
104
Maintainers
Readme
zoro.js
Getting Started
$ npm install zoro
Usage
zoro
.waterfall([
[Posts, 'get', 12345]
[Authors, 'get']
])
.done(function(result){
console.log(result);
})
.fail(function(err){
concole.log(err);
});
case of express app
var zoro = require('zoro');
exports.render = function(req, res){
var id = req.params.id;
zoro
.parallel({
user : [Users, 'getById', id],
review : [Reviews, 'getByUser', id]
})
.done(function(result){
res.json(result);
})
.fail(function(err){
concole.log(err);
});
};
Feature
zoro.waterfall()
has about the same function as async.waterfall()zoro.series()
has about the same function as async.series()zoro.parallel()
has about the same function as async.parallel()zoro.done()
defines a callback function when all async functions successzoro.fail()
defines a callback function when any async functions errorzoro.always()
defines a callback function when all async functions finishzoro.bind()
changes context of async functions