# apr-waterfall

> Runs the tasks array of functions in series, each passing their results to the next in the array.

Latest version **3.0.3** (published 2018-01-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install apr-waterfall
pnpm add apr-waterfall
yarn add apr-waterfall
bun add apr-waterfall
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.3 |
| Published | 2018-01-28 |
| First published | 2017-02-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 75 |
| Author | Sérgio Ramos |
| Maintainers | ramitos |
| Keywords | waterfall, async, await, promise, control, flow, control-flow, awaitful, promises, async-await, es2015, es2016, es2017, es6, es7, es8 |

## Links

- npm: https://www.npmjs.com/package/apr-waterfall
- Repository: https://github.com/ramitos/apr
- Homepage: https://apr.js.org/#waterfall
- Issues: https://github.com/ramitos/apr/issues
- npm.io page: https://npm.io/package/apr-waterfall

## Dependencies (1)

- [apr-engine-each](https://npm.io/package/apr-engine-each.md) ^3.0.3

## Alternatives

- [promise-throttle](https://npm.io/package/promise-throttle.md) — 44.2K weekly downloads
- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads

## Recent versions

- 3.0.3 (latest) — 2018-01-28
- 3.0.2 — 2018-01-23
- 3.0.1 — 2018-01-23
- 3.0.0 — 2018-01-23
- 1.0.5 — 2017-05-12
- 1.0.4 — 2017-05-11
- 1.0.3 — 2017-02-26
- 1.0.2 — 2017-02-25
- 1.0.1 — 2017-02-09
- 1.0.0 — 2017-02-08

## README

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

## waterfall

<a id="waterfall"></a>
Runs the `tasks` array of functions in series, each passing their results to the next in the array.

[![](https://img.shields.io/npm/v/apr-waterfall.svg?style=flat-square)](https://www.npmjs.com/package/apr-waterfall) [![](https://img.shields.io/npm/l/apr-waterfall.svg?style=flat-square)](https://www.npmjs.com/package/apr-waterfall)

**Parameters**

-   `tasks` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)> | [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object))** 
-   `initial` **Any?** 

**Examples**

```javascript
import waterfall from 'apr-waterfall';

const then = (v) => new Promise((resolve) => resolve(v));

const output = await waterfall([
  async () => await then(1),
  async (v) => await then(v + 2),
  async (v) => await then(v + 3)
]);

// output = 6
```

Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)**

---
_Source: https://npm.io/package/apr-waterfall · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
