Erik Römmelt 538894d4a6 Add server; add node_modules; add public folder; add package.json | 6 years ago | |
---|---|---|
.. | ||
LICENSE | 6 years ago | |
README.md | 6 years ago | |
array-flatten.js | 6 years ago | |
package.json | 6 years ago |
Flatten an array of nested arrays into a single flat array. Accepts an optional depth.
npm install array-flatten --save
var flatten = require('array-flatten')
flatten([1, [2, [3, [4, [5], 6], 7], 8], 9])
//=> [1, 2, 3, 4, 5, 6, 7, 8, 9]
flatten([1, [2, [3, [4, [5], 6], 7], 8], 9], 2)
//=> [1, 2, 3, [4, [5], 6], 7, 8, 9]
(function () {
flatten(arguments) //=> [1, 2, 3]
})(1, [2, 3])
MIT