1.1.1 • Published 2 years ago
@vasturiano/flatten v1.1.1
flatten
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]