# pipe-promise

> Run asynchronous pipelines with helper functions for common array operations.

Latest version **1.0.0** (published 2018-07-01) · ISC license · 0 weekly downloads

## Install

```sh
npm install pipe-promise
pnpm add pipe-promise
yarn add pipe-promise
bun add pipe-promise
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2018-07-01 |
| First published | 2018-07-01 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Nikolas Rølland Hugsted |
| Maintainers | nikolasrh |
| Keywords | pipe, pipeline, array, map, filter, reduce, promise, promises, async, await |

## Links

- npm: https://www.npmjs.com/package/pipe-promise
- Repository: https://github.com/nikolasrh/pipe-promise
- Homepage: https://github.com/nikolasrh/pipe-promise#readme
- Issues: https://github.com/nikolasrh/pipe-promise/issues
- npm.io page: https://npm.io/package/pipe-promise

## Alternatives

- [@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
- [fa](https://npm.io/package/fa.md) — 185 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2018-07-01

## README

# pipe-promise

Run asynchronous pipelines with helper functions for common array operations.

If the first argument isn't a promise, and no function return a promises, then the pipeline runs synchronously.

## Helper functions

* map
* filter
* reduce
* foreach

## Examples

### Require:

```js
const { pipe, map, filter, reduce, foreach } = require("pipe-promise")
```

### Async pipeline using await:

```js
await pipe(
    Promise.resolve([ 1, 2, 3 ]),
    filter(n => Promise.resolve(n !== 1)),
    map(n => Promise.resolve(n + 1)),
    reduce((sum, n) => Promise.resolve(sum + n))
) // 7
```

### Sync pipeline:

```js
pipe(
    [ 1, 2, 3 ],
    filter(n => n !== 1),
    map(n => n + 1),
    reduce((sum, n) => sum + n)
) // 7
```

### foreach:

`foreach()` runs sequentially and returns the input data

```js
pipe(
    [ 1, 2, 3 ],
    foreach(console.log)
) // [ 1, 2, 3 ]
```

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