A tiny utility to flatten arrays of arrays (of arrays, etc., recursively) into a single array of non-arrays.
JavaScript
Switch branches/tags
Nothing to show
Latest commit ef62d45 Jan 20, 2016 @jfhbrook Release 1.0.2
Permalink
Failed to load latest commit information.
LICENSE Add MIT license Jan 20, 2016
README.md
index.js
package.json
test.js Return shallow clone of list on depth 0, fixes #2 Jan 20, 2016

README.md

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.