peach a19a732be8 commit message | 2 years ago | |
---|---|---|
.. | ||
LICENSE | 2 years ago | |
README.md | 2 years ago | |
index.js | 2 years ago | |
package.json | 2 years ago | |
test.js | 2 years ago |
A tiny utility to flatten arrays of arrays (of arrays, etc., recursively, infinitely or to an optional depth) into a single array of non-arrays.
> var flatten = require('flatten');
undefined
> flatten([1, [2, 3], [4, 5, 6], [7, [8, 9]], 10])
[ 1,
2,
3,
4,
5,
6,
7,
8,
9,
10 ]
> flatten([1, [2, [3, [4, [5]]]]], 2)
[ 1,
2,
3,
[ 4, [ 5 ] ] ]
npm install flatten
MIT/X11.