Skip to content

Latest commit

 

History

History
48 lines (41 loc) · 1.58 KB

README.md

File metadata and controls

48 lines (41 loc) · 1.58 KB

waterfall-then

NPM version Build status Test coverage Dependency Status License Downloads

Sequentially resolve a series of promise-returning function, returning the previous function's values.

const waterfall = require('waterfall-then')
const assert = require('assert')

const fn = waterfall([
  val => {
    assert.equal(val, 0)
    return Promise.resolve(1)
  },
  val => {
    assert.equal(val, 1)
    return Promise.resolve(2)
  },
  val => {
    assert.equal(val, 2)
    return Promise.resolve(3)
  }
])

fn(0).then(val => {
  assert.equal(val, 3)
})