UNPKG

@extra-array/flat

Version:

Flattens nested array to given depth.

9 lines (5 loc) 125 B
const array = require("extra-array"); var x = [[1, 2], [3, [4, [5]]]]; array.flat(x); array.flat(x, 1); array.flat(x, 2);