Skip to content

waterfall/sequential chaining of promise-returning functions

License

Notifications You must be signed in to change notification settings

thenables/waterfall-then

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

waterfall/sequential chaining of promise-returning functions

Resources

License

Stars

Watchers

Forks

Packages

No packages published