@extra-array/flat.min
TypeScript icon, indicating that this package has built-in type declarations

2.10.19 • Public • Published

Flattens nested array to given depth. 📦 😺 🏃 📼 🌔 📜 📰 📘

Alternatives: flat, flatMap.

This is part of package extra-array.

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


array.flat(x, [n], [fm], [ft]);
// x:  a nested array
// n:  maximum depth (-1 => all)
// fm: map function (v, i, x)
// ft: test function (v, i, x)
const array = require("extra-array");

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

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

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


References

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
2.10.190latest

Version History

VersionDownloads (Last 7 Days)Published
2.10.190
2.10.180
2.10.170
2.10.160
2.10.150
2.10.140
2.10.130
2.10.120
2.10.110
2.10.100
2.10.90
2.10.80
2.10.70
2.10.61
2.10.50
2.10.40
2.10.20
2.10.10
2.10.00
2.9.640
2.9.630
2.9.620
2.9.610
2.9.600
2.9.590
2.9.580
2.9.570
2.9.560
2.9.550
2.9.540
2.9.530
2.9.521
2.9.510
2.9.500
2.9.490
2.9.480
2.9.470
2.9.460
2.9.450
2.9.440
2.9.430
2.9.420
2.9.410
2.9.400
2.9.390
2.9.380
2.9.370
2.9.360
2.9.350
2.9.340
2.9.330
2.9.120
2.9.110
2.9.100
2.9.90
2.9.80
2.9.70
2.9.60
2.9.50
2.9.40
2.9.30
2.9.20
2.9.10
2.9.00
2.8.760
2.8.750
2.8.740
2.8.730
2.8.720
2.8.710
2.8.700
2.8.690
2.8.670
2.8.660
2.8.650
2.8.640
2.8.630
2.8.620
2.8.610
2.8.600
2.8.590
2.8.580
2.8.570
2.8.560
2.8.550
2.8.540
2.8.530
2.8.520
2.8.510
2.8.500
2.8.490
2.8.481
2.8.470
2.8.460
2.8.450
2.8.440
2.8.430
2.8.420
2.8.410
2.8.400
2.8.390
2.8.380
2.8.370
2.8.360
2.8.350
2.8.340
2.8.330
2.8.320
2.8.310
2.8.300
2.8.290
2.8.280
2.8.270
2.8.260
2.8.250
2.8.230
2.8.220
2.8.210
2.8.200
2.8.190
2.8.180
2.8.170
2.8.160
2.8.150
2.8.140
2.8.130
2.8.120
2.8.110
2.8.100
2.8.90
2.8.80
2.8.60
2.8.50
2.8.40
2.8.30
2.8.20
2.8.10
2.8.00
2.7.80
2.7.60
2.7.50
2.7.40
2.7.30
2.7.20
2.7.00
2.6.860
2.6.850
2.6.840
2.6.830
2.6.820
2.6.810
2.6.790
2.6.780
2.6.770
2.6.760
2.6.750
2.6.740
2.6.730
2.6.720
2.6.710
2.6.700
2.6.690
2.6.680
2.6.670
2.6.660
2.6.650
2.6.640
2.6.630
2.6.620
2.6.610
2.6.600
2.6.590
2.6.580
2.6.570
2.6.560
2.6.550
2.6.540
2.6.530
2.6.520
2.6.510
2.6.500
2.6.490
2.6.480
2.6.470
2.6.460
2.6.450
2.6.440
2.6.430
2.6.420
2.6.410
2.6.400
2.6.390
2.6.380
2.6.360
2.6.350
2.6.340
2.6.320
2.6.310
2.6.300
2.6.290
2.6.280
2.5.220
2.5.210
2.5.200
2.5.190
2.5.180
2.5.170
2.5.160
2.5.150
2.5.140
2.5.130
2.5.120
2.5.110
2.5.100
2.5.90
2.5.80
2.5.60
2.5.50
2.5.40
2.5.30
2.5.20
2.5.10
2.5.00
2.4.520
2.4.510
2.4.500
2.4.490
2.4.480
2.4.470
2.4.460
2.4.450
2.4.440
2.4.430
2.4.420
2.4.410
2.4.400
2.4.390
2.4.380
2.4.370
2.4.360
2.4.350
2.4.340
2.4.330
2.4.320
2.4.310
2.4.300
2.4.290
2.4.280
2.4.270
2.4.260
2.4.250
2.4.240
2.4.230
2.4.220
2.4.210
2.4.200
2.4.190
2.4.180
2.4.170
2.4.160
2.4.150
2.4.140
2.4.130
2.4.120
2.4.110
2.4.100
2.4.90
2.4.80
2.4.70
2.4.60
2.4.50
2.4.40
2.4.30
2.4.10
2.4.00
2.3.260
2.3.250

Package Sidebar

Install

npm i @extra-array/flat.min

Weekly Downloads

3

Version

2.10.19

License

MIT

Unpacked Size

5.81 kB

Total Files

8

Last publish

Collaborators

  • wolfram77