array flatten
Just a simple function to flatten an Array. Works well in both, the browser & node.
install
npm i -S flat-array
and use it
// ORconst flattenArray = const abcde = console // ['a', 'b', 'c', 'd', 'e'] // NOTE: the result is shadow flatted, only the first lvl arrays are flattenedconst fooBar = console // ['f', 'o', 'o', 'b', ['a', 'r']]
behavior
flattenArray
is a pure function, it does not mutate the provided array.
FAQ
- Why such small module?: Sindre gives a good answer to this.