@extra-array/flatten.min

2.3.10 • Public • Published

Flattens nested array to given depth.

This is part of package extra-array.

This is browserified, minified version of @extra-array/flatten.
It is exported as global variable array_flatten.
CDN: unpkg, jsDelivr.

array.flatten(x, [dep]);
// x:   a nested array
// dep: maximum depth (-1)
// --> flattened
const array = require('extra-array');

var x = [[1, 2], [3, [4, [5]]]];
array.flatten(x);
// [1, 2, 3, 4, 5]

array.flatten(x, 1);
// [1, 2, 3, [4, [5]]]

array.flatten(x, 2);
// [1, 2, 3, 4, [5]]

references

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i @extra-array/flatten.min

      Weekly Downloads

      2

      Version

      2.3.10

      License

      MIT

      Unpacked Size

      3.84 kB

      Total Files

      3

      Last publish

      Collaborators

      • wolfram77