chainz

1.0.2 • Public • Published

Chainz

Build Status

Helps call an array of async functions in order, by injecting a next callback.

  var chain = require('chainz');
 
  const asyncFunctionOne = next => {
    // do something asnyc
    next('cheese'); // calls asyncFunctionTwo
  };
 
  const asyncFunctionTwo = (message, next) => {
    // do something asnyc
    console.log(message); // cheese
    next('peanut butter'); // calls asyncFunctionThree
  };
 
  const asyncFunctionThree = message => {
    // done
    console.log(message); // peanut butter
  };
 
  chain(asyncFunctionOne, asyncFunctionTwo, asyncFunctionThree);
 

Readme

Keywords

Package Sidebar

Install

npm i chainz

Weekly Downloads

7

Version

1.0.2

License

MIT

Last publish

Collaborators

  • turbobeast