README.md (1245B)
1 # Array Flatten 2 3 [![NPM version][npm-image]][npm-url] 4 [![NPM downloads][downloads-image]][downloads-url] 5 [![Build status][travis-image]][travis-url] 6 [![Test coverage][coveralls-image]][coveralls-url] 7 8 > Flatten an array of nested arrays into a single flat array. Accepts an optional depth. 9 10 ## Installation 11 12 ``` 13 npm install array-flatten --save 14 ``` 15 16 ## Usage 17 18 ```javascript 19 var flatten = require('array-flatten') 20 21 flatten([1, [2, [3, [4, [5], 6], 7], 8], 9]) 22 //=> [1, 2, 3, 4, 5, 6, 7, 8, 9] 23 24 flatten([1, [2, [3, [4, [5], 6], 7], 8], 9], 2) 25 //=> [1, 2, 3, [4, [5], 6], 7, 8, 9] 26 27 (function () { 28 flatten(arguments) //=> [1, 2, 3] 29 })(1, [2, 3]) 30 ``` 31 32 ## License 33 34 MIT 35 36 [npm-image]: https://img.shields.io/npm/v/array-flatten.svg?style=flat 37 [npm-url]: https://npmjs.org/package/array-flatten 38 [downloads-image]: https://img.shields.io/npm/dm/array-flatten.svg?style=flat 39 [downloads-url]: https://npmjs.org/package/array-flatten 40 [travis-image]: https://img.shields.io/travis/blakeembrey/array-flatten.svg?style=flat 41 [travis-url]: https://travis-ci.org/blakeembrey/array-flatten 42 [coveralls-image]: https://img.shields.io/coveralls/blakeembrey/array-flatten.svg?style=flat 43 [coveralls-url]: https://coveralls.io/r/blakeembrey/array-flatten?branch=master