Irina Glushko 2389e7160b HW1 done | 3 gadi atpakaļ | |
---|---|---|
.. | ||
LICENSE | 3 gadi atpakaļ | |
README.md | 3 gadi atpakaļ | |
array-flatten.d.ts | 3 gadi atpakaļ | |
array-flatten.js | 3 gadi atpakaļ | |
package.json | 3 gadi atpakaļ |
Flatten nested arrays.
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.depth([1, [2, [3, [4, [5], 6], 7], 8], 9], 2)
//=> [1, 2, 3, [4, [5], 6], 7, 8, 9]
(function () {
flatten.from(arguments) //=> [1, 2, 3]
})(1, [2, 3])
MIT