Socket
Socket
Sign inDemoInstall

waterfally

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    waterfally

Waterfally do similar as async.waterfall (sequential flow control) with support of promises


Version published
Weekly downloads
59
decreased by-64.46%
Maintainers
1
Install size
3.52 kB
Created
Weekly downloads
 

Readme

Source

Waterfally

Waterfally do similar as async.waterfall (sequential flow control) with support of promises.

Since Promise.all(promiseArr) || Promise.spread(promiseArr) execs promises simultaneously, each of the functions in the promiseArr cannot depend on another, and if you want promises execute in order or some of the promises need the resolved value of another, this library is for you.

Installation

npm install waterfally

Usage

var waterfall = require("waterfally");
var func1 = function(){
        // return a promise
    },
    func2 = function(res1){
        // optionally use res1 
        // which is resolved from func1 
        // and return a promise
    },
    func3 = function(res2){
        // like func2
    },
    promiseSequence = [func1, func2, func3];
    
waterfall(promiseSequence) 
    // the promiseSequence will executes sequentially
    // just like func1().then(func2).then(func3)
    .then(function(res){
        // use res
    })
    .catch(function(err){
        // deal with error
    });

Keywords

FAQs

Last updated on 10 Feb 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc