# flatmap-fast

> A fast and modern flatMap for node. Monads for the win!

Latest version **4.0.1** (published 2021-01-29) · GPL-2.0+ license · 0 weekly downloads

## Install

```sh
npm install flatmap-fast
pnpm add flatmap-fast
yarn add flatmap-fast
bun add flatmap-fast
```

## 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 | 4.0.1 |
| Published | 2021-01-29 |
| First published | 2016-05-21 |
| Weekly downloads | 0 |
| License | GPL-2.0+ |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4.x.x |
| Dependencies | 0 |
| Unpacked size | 21 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Ryan P. C. McQuen |
| Maintainers | ryanpcmcquen |
| Keywords | flatmap, fast, functional, monad |

## Links

- npm: https://www.npmjs.com/package/flatmap-fast
- Repository: https://github.com/ryanpcmcquen/flatmap-fast
- Homepage: https://github.com/ryanpcmcquen/flatmap-fast#readme
- Issues: https://github.com/ryanpcmcquen/flatmap-fast/issues
- npm.io page: https://npm.io/package/flatmap-fast

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 4.0.1 (latest) — 2021-01-29
- 4.0.0 — 2020-09-09
- 3.0.0 — 2017-03-30
- 2.0.3 — 2016-10-28
- 2.0.2 — 2016-05-31
- 2.0.1 — 2016-05-24
- 2.0.0 — 2016-05-23
- 1.0.4 — 2016-05-21
- 1.0.3 — 2016-05-21
- 1.0.2 — 2016-05-21
- 1.0.1 — 2016-05-21
- 1.0.0 — 2016-05-21

## README

[![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/ryanpcmcquen/flatmap-fast)

# flatmap-fast

The fastest `flatMap` this side of `node`.

Takes two arguments:

  1. An array.
  2. A callback function (optional).

```javascript
const flatMap = require("flatmap-fast");

const testArr = ['Hi', 'World'];
const splitWord = (word) => word.split('');

flatMap(testArr, splitWord);

// => ['H', 'i', 'W', 'o', 'r', 'l', 'd']

flatMap([1, 2, 3, 4], (x) => [x, x * 2]);

// => [1, 2, 2, 4, 3, 6, 4, 8]
```

Run `npm test` to test this flatMap against other flatMaps.

```javascript
$ node --version
v12.18.3
$ yarn test
yarn run v1.22.4
$ node test.js
// => flatMapFast took: 650.86651 milliseconds.
[
  'H', 'i', 'W',
  'o', 'r', 'l',
  'd'
]
// => flatmapjs took: 667.361729 milliseconds.
[
  'H', 'i', 'W',
  'o', 'r', 'l',
  'd'
]
// => flatMapFast took: 517.463478 milliseconds.
[
  1, 2, 2, 4,
  3, 6, 4, 8
]
// => flatmapjs took: 676.208413 milliseconds.
[
  1, 2, 2, 4,
  3, 6, 4, 8
]
Done in 2.74s.
```

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