1.1.1 • Published 1 year ago

@vasturiano/flatten v1.1.1

Weekly downloads
1
License
MIT
Repository
github
Last release
1 year ago

flatten

NPM package Build Size NPM Downloads

A utility function to recursively flatten nested arrays with arbitrary levels

flatten(array)

Quick start

import flatten from '@vasturiano/flatten';

or using a script tag

<script src="//unpkg.com/@vasturiano/flatten"></script>

Usage example

const nestedArray = [
  1, 
  [
    2, 
    [3, 4], 
    [
      5, 
      6, 
      [7, 8]
    ], 
    9
  ], 
  [
    10, 
    [11]
  ]
];

flatten(nestedArray);

// Result: 
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
1.1.1

1 year ago

1.1.0

1 year ago

1.0.6

2 years ago

1.0.5

3 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

6 years ago