UNPKG

p-waterfall

Version:

Run promise-returning & async functions in series, each passing its result to the next

6 lines (4 loc) 199 B
import pReduce from 'p-reduce'; export default async function pWaterfall(iterable, initialValue) { return pReduce(iterable, (previousValue, function_) => function_(previousValue), initialValue); }