flatten

mk-pmb
js deprecated
flatten JS library on GitHub flatten JS library on npm Download flatten JS library

Flatten arbitrarily nested arrays into a non-nested list of non-array items. Maintained for legacy compatibility.

Version 1.0.3 License MIT
flatten has no homepage
flatten JS library on GitHub
flatten JS library on npm
Download flatten JS library
Keywords
arrayflatten
No default JS file set by the package author so the URL is guessed. You can always browse all package files to use another one.

flatten

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.

example:

> 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 ] ] ]

install:

npm install flatten

license:

MIT/X11.