flatten

Flatten arbitrarily nested arrays into a non-nested list of non-array items

flatten is deprecated in favor of utility frameworks such as lodash.
Last updated 12 years ago by jesusabdullah .
Repository · Original npm · Tarball · package.json
$ gnpm install flatten 
SYNC missed versions from official npm registry.

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.

Current Tags

  • 1.0.3                                ...           latest (5 years ago)

6 Versions

  • 1.0.3 [deprecated]           ...           5 years ago
  • 1.0.2 [deprecated]           ...           9 years ago
  • 1.0.1 [deprecated]           ...           9 years ago
  • 1.0.0 [deprecated]           ...           9 years ago
  • 0.0.1 [deprecated]           ...           12 years ago
  • 0.0.0 [deprecated]           ...           12 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (0)
None

Copyright 2013 - present © cnpmjs.org | Home |