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.

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