Skip to content

esundahl/flatten

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

flatten

Flattens a nested array. If isShallow is truthy, array will only be flattened a single level.

Installation

$ component install esundahl/flatten

API

flatten(arr, isShallow)

var flatten = require('flatten');
var arr = [[1,2],[3,[4,5]],6,7,[[8],[9,10]]];
   
flatten(arr) // => [1,2,3,4,5,6,7,8,9,10]
flatten(arr, true); // => [1,2,3,[4,5],6,7,[8],[9,10]]

License

MIT

About

Flattens a nested array.

Resources

Stars

Watchers

Forks

Packages

No packages published