source: trip-planner-front/node_modules/array-flatten/README.md@ 6c1585f

Last change on this file since 6c1585f was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.5 KB
Line 
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 nested arrays.
9
10## Installation
11
12```
13npm install array-flatten --save
14```
15
16## Usage
17
18```javascript
19var flatten = require('array-flatten')
20
21flatten([1, [2, [3, [4, [5], 6], 7], 8], 9])
22//=> [1, 2, 3, 4, 5, 6, 7, 8, 9]
23
24flatten.depth([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.from(arguments) //=> [1, 2, 3]
29})(1, [2, 3])
30```
31
32### Methods
33
34* **flatten(array)** Flatten a nested array structure
35* **flatten.from(arrayish)** Flatten an array-like structure (E.g. arguments)
36* **flatten.depth(array, depth)** Flatten a nested array structure with a specific depth
37* **flatten.fromDepth(arrayish, depth)** Flatten an array-like structure with a specific depth
38
39## License
40
41MIT
42
43[npm-image]: https://img.shields.io/npm/v/array-flatten.svg?style=flat
44[npm-url]: https://npmjs.org/package/array-flatten
45[downloads-image]: https://img.shields.io/npm/dm/array-flatten.svg?style=flat
46[downloads-url]: https://npmjs.org/package/array-flatten
47[travis-image]: https://img.shields.io/travis/blakeembrey/array-flatten.svg?style=flat
48[travis-url]: https://travis-ci.org/blakeembrey/array-flatten
49[coveralls-image]: https://img.shields.io/coveralls/blakeembrey/array-flatten.svg?style=flat
50[coveralls-url]: https://coveralls.io/r/blakeembrey/array-flatten?branch=master
Note: See TracBrowser for help on using the repository browser.