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