zoro

0.5.0 • Public • Published

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 success
  • zoro.fail() defines a callback function when any async functions error
  • zoro.always() defines a callback function when all async functions finish
  • zoro.bind() changes context of async functions

Package Sidebar

Install

npm i zoro

Weekly Downloads

41

Version

0.5.0

License

ISC

Last publish

Collaborators

  • honmaaax