1 | # arr-flatten [![NPM version](https://img.shields.io/npm/v/arr-flatten.svg?style=flat)](https://www.npmjs.com/package/arr-flatten) [![NPM monthly downloads](https://img.shields.io/npm/dm/arr-flatten.svg?style=flat)](https://npmjs.org/package/arr-flatten) [![NPM total downloads](https://img.shields.io/npm/dt/arr-flatten.svg?style=flat)](https://npmjs.org/package/arr-flatten) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/arr-flatten.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/arr-flatten) [![Windows Build Status](https://img.shields.io/appveyor/ci/jonschlinkert/arr-flatten.svg?style=flat&label=AppVeyor)](https://ci.appveyor.com/project/jonschlinkert/arr-flatten)
|
---|
2 |
|
---|
3 | > Recursively flatten an array or arrays.
|
---|
4 |
|
---|
5 | ## Install
|
---|
6 |
|
---|
7 | Install with [npm](https://www.npmjs.com/):
|
---|
8 |
|
---|
9 | ```sh
|
---|
10 | $ npm install --save arr-flatten
|
---|
11 | ```
|
---|
12 |
|
---|
13 | ## Install
|
---|
14 |
|
---|
15 | Install with [bower](https://bower.io/)
|
---|
16 |
|
---|
17 | ```sh
|
---|
18 | $ bower install arr-flatten --save
|
---|
19 | ```
|
---|
20 |
|
---|
21 | ## Usage
|
---|
22 |
|
---|
23 | ```js
|
---|
24 | var flatten = require('arr-flatten');
|
---|
25 |
|
---|
26 | flatten(['a', ['b', ['c']], 'd', ['e']]);
|
---|
27 | //=> ['a', 'b', 'c', 'd', 'e']
|
---|
28 | ```
|
---|
29 |
|
---|
30 | ## Why another flatten utility?
|
---|
31 |
|
---|
32 | I wanted the fastest implementation I could find, with implementation choices that should work for 95% of use cases, but no cruft to cover the other 5%.
|
---|
33 |
|
---|
34 | ## About
|
---|
35 |
|
---|
36 | ### Related projects
|
---|
37 |
|
---|
38 | * [arr-filter](https://www.npmjs.com/package/arr-filter): Faster alternative to javascript's native filter method. | [homepage](https://github.com/jonschlinkert/arr-filter "Faster alternative to javascript's native filter method.")
|
---|
39 | * [arr-union](https://www.npmjs.com/package/arr-union): Combines a list of arrays, returning a single array with unique values, using strict equality… [more](https://github.com/jonschlinkert/arr-union) | [homepage](https://github.com/jonschlinkert/arr-union "Combines a list of arrays, returning a single array with unique values, using strict equality for comparisons.")
|
---|
40 | * [array-each](https://www.npmjs.com/package/array-each): Loop over each item in an array and call the given function on every element. | [homepage](https://github.com/jonschlinkert/array-each "Loop over each item in an array and call the given function on every element.")
|
---|
41 | * [array-unique](https://www.npmjs.com/package/array-unique): Remove duplicate values from an array. Fastest ES5 implementation. | [homepage](https://github.com/jonschlinkert/array-unique "Remove duplicate values from an array. Fastest ES5 implementation.")
|
---|
42 |
|
---|
43 | ### Contributing
|
---|
44 |
|
---|
45 | Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
|
---|
46 |
|
---|
47 | ### Contributors
|
---|
48 |
|
---|
49 | | **Commits** | **Contributor** |
|
---|
50 | | --- | --- |
|
---|
51 | | 20 | [jonschlinkert](https://github.com/jonschlinkert) |
|
---|
52 | | 1 | [lukeed](https://github.com/lukeed) |
|
---|
53 |
|
---|
54 | ### Building docs
|
---|
55 |
|
---|
56 | _(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
|
---|
57 |
|
---|
58 | To generate the readme, run the following command:
|
---|
59 |
|
---|
60 | ```sh
|
---|
61 | $ npm install -g verbose/verb#dev verb-generate-readme && verb
|
---|
62 | ```
|
---|
63 |
|
---|
64 | ### Running tests
|
---|
65 |
|
---|
66 | Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
|
---|
67 |
|
---|
68 | ```sh
|
---|
69 | $ npm install && npm test
|
---|
70 | ```
|
---|
71 |
|
---|
72 | ### Author
|
---|
73 |
|
---|
74 | **Jon Schlinkert**
|
---|
75 |
|
---|
76 | * [github/jonschlinkert](https://github.com/jonschlinkert)
|
---|
77 | * [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
|
---|
78 |
|
---|
79 | ### License
|
---|
80 |
|
---|
81 | Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
|
---|
82 | Released under the [MIT License](LICENSE).
|
---|
83 |
|
---|
84 | ***
|
---|
85 |
|
---|
86 | _This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on July 05, 2017._ |
---|