You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 3.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. > Recursively flatten an array or arrays.
  3. ## Install
  4. Install with [npm](https://www.npmjs.com/):
  5. ```sh
  6. $ npm install --save arr-flatten
  7. ```
  8. ## Install
  9. Install with [bower](https://bower.io/)
  10. ```sh
  11. $ bower install arr-flatten --save
  12. ```
  13. ## Usage
  14. ```js
  15. var flatten = require('arr-flatten');
  16. flatten(['a', ['b', ['c']], 'd', ['e']]);
  17. //=> ['a', 'b', 'c', 'd', 'e']
  18. ```
  19. ## Why another flatten utility?
  20. 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%.
  21. ## About
  22. ### Related projects
  23. * [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.")
  24. * [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.")
  25. * [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.")
  26. * [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.")
  27. ### Contributing
  28. Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
  29. ### Contributors
  30. | **Commits** | **Contributor** |
  31. | --- | --- |
  32. | 20 | [jonschlinkert](https://github.com/jonschlinkert) |
  33. | 1 | [lukeed](https://github.com/lukeed) |
  34. ### Building docs
  35. _(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.)_
  36. To generate the readme, run the following command:
  37. ```sh
  38. $ npm install -g verbose/verb#dev verb-generate-readme && verb
  39. ```
  40. ### Running tests
  41. 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:
  42. ```sh
  43. $ npm install && npm test
  44. ```
  45. ### Author
  46. **Jon Schlinkert**
  47. * [github/jonschlinkert](https://github.com/jonschlinkert)
  48. * [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
  49. ### License
  50. Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
  51. Released under the [MIT License](LICENSE).
  52. ***
  53. _This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on July 05, 2017._