Skip to content

Runs an array of promises in series, each passing their results to the next promise in the array.

License

Notifications You must be signed in to change notification settings

notjrbauer/promise.waterfall

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

promise-waterfall

Runs an array of promises in series, each passing their results to the next promise in the array.

NPM

Install

$ npm install promise.waterfall --save

Usage

var promiseWaterfall = require('promise.waterfall')

function makeAdder (a) {
  return function (b) {
    b = b || 0
    return Promise.resolve(a + b)
  }
}

var addOne = makeAdder(1)

promiseWaterfall([
  addOne  // 1
  addOne, // 2
  addOne  // 3
])
.then(console.log)
.catch(console.error)

API

promiseWaterfall(functions) -> promise

Runs the array of functions in series, waiting for each to resolve and passing each result to the next function in the array.

functions

Required Type: array[function]

About

Runs an array of promises in series, each passing their results to the next promise in the array.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •