npm.io
5.2.0 • Published 3 years ago

just-flatten-it

Licence
MIT
Version
5.2.0
Deps
0
Size
5 kB
Vulns
0
Weekly
0
Stars
6.2K

just-flatten-it

Part of a library of zero-dependency npm modules that do just do one thing. Guilt-free utilities for every occasion.

🍦 Try it

npm install just-flatten-it
yarn add just-flatten-it

Return a flattened array

import flatten from 'just-flatten-it';

flatten([[1, [2, 3]], [[4, 5], 6, 7, [8, 9]]]);
// [1, 2, 3, 4, 5, 6, 7, 8, 9]

flatten([[1, [2, 3]], [[4, 5], 6, 7, [8, 9]]], 1);
// [1, [2, 3], [[4, 5], 6, 7, [8, 9]]]

Keywords