JSPM

zoro

0.5.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 32
  • Score
    100M100P100Q55689F
  • License ISC

Async with like promise

Package Exports

  • zoro

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (zoro) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

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 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