# functional-streams

> Native implementations of map, reduce, and batch, to act on streams.

Latest version **2.0.2** (published 2018-07-12) · ISC license · 0 weekly downloads

## Install

```sh
npm install functional-streams
pnpm add functional-streams
yarn add functional-streams
bun add functional-streams
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.2 |
| Published | 2018-07-12 |
| First published | 2017-01-31 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=8 |
| Dependencies | 0 |
| Unpacked size | 38.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Jarrad Whitaker |
| Maintainers | akdor1154 |
| Keywords | streams, transform, stream, map, reduce, filter, batch |

## Links

- npm: https://www.npmjs.com/package/functional-streams
- Repository: https://github.com/akdor1154/node-functional-streams
- Homepage: https://github.com/akdor1154/node-functional-streams#readme
- Issues: https://github.com/akdor1154/node-functional-streams/issues
- npm.io page: https://npm.io/package/functional-streams

## Alternatives

- [byte-size](https://npm.io/package/byte-size.md) — 2.1M weekly downloads
- [speed-limiter](https://npm.io/package/speed-limiter.md) — 16.0K weekly downloads
- [@powersync/node](https://npm.io/package/@powersync/node.md) — 10.9K weekly downloads
- [@ledgerhq/coin-cardano](https://npm.io/package/@ledgerhq/coin-cardano.md) — 1.0K weekly downloads
- [@jayesol/jayeson.lib.streamfinder](https://npm.io/package/@jayesol/jayeson.lib.streamfinder.md) — 1.0K weekly downloads

## Recent versions

- 2.0.2 (latest) — 2018-07-12
- 2.0.1 — 2018-07-12
- 2.0.0 — 2018-07-12
- 1.0.11 — 2018-07-12
- 1.0.10 — 2017-10-20
- 1.0.8 — 2017-06-30
- 1.0.7 — 2017-06-30
- 1.0.6 — 2017-06-30
- 1.0.5 — 2017-06-29
- 1.0.4 — 2017-06-29
- 1.0.2 — 2017-01-31
- 1.0.1 — 2017-01-31
- 1.0.0 — 2017-01-31

## README

# Functional Streams

[![CircleCI](https://circleci.com/gh/akdor1154/node-functional-streams.svg?style=svg)](https://circleci.com/gh/akdor1154/node-functional-streams)

Provides four native Node streams that mirror the behaviour of basic FP array manipulations. As they extend
directly from Node native streams, they can be `pipe`d and emit events as you are used to. No runtime dependencies, typescript definitions included.

```ts
const FS = require('functional-streams');
```

## Map

```js
const mapStream = new FS.Map((n) => n + 2);
```

## Filter

```js
const filterStream = new FS.Filter((n) => n % 2 === 0);
```

## Reduce

Provides a `then` method so this can be used in a promise-like fashion to get the end result.

```js
const reduceStream = new FS.Reduce((sum, n) => sum + n, 0);

reduceStream.write(0);
reduceStream.write(1);
reduceStream.write(2);
reduceStream.write(3);
reduceStream.end(4);

reduceStream.then((result) => {
	console.log(result); // 10
});
```

## Batch

```js
const batchStream = new FS.Batch(3);

batchStream.write(0);
batchStream.write(1);
batchStream.write(2);
batchStream.write(3);
batchStream.end(4);

batchStream.read(); // [0, 1, 2];
batchStream.read(); // [3, 4];
```

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