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

2.10.19 • Public • Published

Lists all possible permutations. 📦 😺 🏃 📼 🌔 📜 📰 📘

Similar: permutation, permutations, hasPermutation.

This is part of package extra-array.


array.permutations(x, [n]);
// x: an array
// n: number of values (-1 => any)
const array = require("extra-array");

[...array.permutations([1, 2])];
// [ [], [ 1 ], [ 2 ], [ 1, 2 ], [ 2, 1 ] ]

[...array.permutations([1, 2, 3])];
// [
//   [],          [ 1 ],
//   [ 2 ],       [ 3 ],
//   [ 1, 2 ],    [ 1, 3 ],
//   [ 2, 1 ],    [ 2, 3 ],
//   [ 3, 1 ],    [ 3, 2 ],
//   [ 1, 2, 3 ], [ 1, 3, 2 ],
//   [ 2, 1, 3 ], [ 2, 3, 1 ],
//   [ 3, 1, 2 ], [ 3, 2, 1 ]
// ]

[...array.permutations([1, 2, 3], 2)];
// [ [ 1, 2 ], [ 1, 3 ], [ 2, 1 ], [ 2, 3 ], [ 3, 1 ], [ 3, 2 ] ]


References

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
2.10.195latest

Version History

VersionDownloads (Last 7 Days)Published
2.10.195
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.60
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.520
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.320
2.9.310
2.9.300
2.9.290
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.620
2.8.630
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.480
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.70
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.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.6.250
2.6.240
2.6.230
2.6.220
2.6.210
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
2.3.240
2.3.230
2.3.220
2.3.210
2.3.200
2.3.190
2.3.180
2.3.170
2.3.160
2.3.150
2.3.140
2.3.130
2.3.120
2.3.110
2.3.100
2.3.90
2.3.80
2.3.70
2.3.60
2.3.50
2.3.40
2.3.30
2.3.20
2.3.10
2.3.00
2.2.170
2.2.160
2.2.150
2.2.130
2.2.120
2.2.110
2.2.100
2.2.90
2.2.80
2.2.70
2.2.60
2.2.50
2.2.40
2.2.30
2.2.20
2.2.10
2.2.00
2.1.750
2.1.740
2.1.730
2.1.720
2.1.710
2.1.700
2.1.690
2.1.680
2.1.670
2.1.660
2.1.650
2.1.640
2.1.630
2.1.620
2.1.610
2.1.600
2.1.590
2.1.580
2.1.570
2.1.560
2.1.550
2.1.540
2.1.530
2.1.520
2.1.510
2.1.500
2.1.490
2.1.480
2.1.470
2.1.460
2.1.450
2.1.440
2.1.430
2.1.420
2.1.410
2.1.400
2.1.390
2.1.380
2.1.370
2.1.360
2.1.350
2.1.340
2.1.330
2.1.320
2.1.310

Package Sidebar

Install

npm i @extra-array/permutations

Weekly Downloads

5

Version

2.10.19

License

MIT

Unpacked Size

5.37 kB

Total Files

8

Last publish

Collaborators

  • wolfram77