Skip to content

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

License

Notifications You must be signed in to change notification settings

mk-pmb/flatten-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published