# reduce-flatten

> Isomorphic map-reduce function to flatten an array into the supplied array

Latest version **3.0.1** (published 2021-05-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install reduce-flatten
pnpm add reduce-flatten
yarn add reduce-flatten
bun add reduce-flatten
```

## 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.1 |
| Published | 2021-05-19 |
| First published | 2016-02-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=8 |
| Dependencies | 0 |
| Unpacked size | 6.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Lloyd Brookes |
| Maintainers | 75lb |
| Keywords | array, reduce, flatten |

## Links

- npm: https://www.npmjs.com/package/reduce-flatten
- Repository: https://github.com/75lb/reduce-flatten
- Homepage: https://github.com/75lb/reduce-flatten#readme
- Issues: https://github.com/75lb/reduce-flatten/issues
- npm.io page: https://npm.io/package/reduce-flatten

## Recent versions

- 3.0.1 (latest) — 2021-05-19
- 3.0.0 — 2019-09-29
- 2.0.0 — 2018-06-04
- 1.0.1 — 2016-06-05
- 1.0.0 — 2016-02-25

## README

[![view on npm](http://img.shields.io/npm/v/reduce-flatten.svg)](https://www.npmjs.org/package/reduce-flatten)
[![npm module downloads](http://img.shields.io/npm/dt/reduce-flatten.svg)](https://www.npmjs.org/package/reduce-flatten)
[![Build Status](https://travis-ci.org/75lb/reduce-flatten.svg?branch=master)](https://travis-ci.org/75lb/reduce-flatten)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)

***DEPRECATED: Please use the [Array.prototype.flat()]() method built into ES2019 and above.***

## reduce-flatten
Isomorphic map-reduce function to flatten an array into the supplied array.

**Example**  
```js
const flatten = require('reduce-flatten')
```
<a name="exp_module_reduce-flatten--flatten"></a>

### flatten() ⏏
**Kind**: Exported function  
**Example**  
```js
> numbers = [ 1, 2, [ 3, 4 ], 5 ]
> numbers.reduce(flatten, [])
[ 1, 2, 3, 4, 5 ]
```

### Load anywhere

This library is compatible with Node.js, the Web and any style of module loader. It can be loaded anywhere, natively without transpilation.

Node.js:

```js
const arrayify = require('reduce-flatten')
```

Within Node.js with ECMAScript Module support enabled:

```js
import arrayify from 'reduce-flatten'
```

Within an modern browser ECMAScript Module:

```js
import arrayify from './node_modules/reduce-flatten/index.mjs'
```

Old browser (adds `window.flatten`):

```html
<script nomodule src="./node_modules/reduce-flatten/dist/index.js"></script>
```

* * *

&copy; 2016-19 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).

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