array-sets

To find all the possible combinations of an array

Usage no npm install needed!

<script type="module">
  import arraySets from 'https://cdn.skypack.dev/array-sets';
</script>

README

To find all the combinations of an array

install the package by using below command

npm install array-sets
You can use it like
const combinations = require(‘array-sets’);
let array_sets = combinations([1,2,3]);
combinations function will return all the possible combinations of input array in an array
[ 1, 2, 3, [ 1, 1 ], [ 1, 2 ], [ 1, 3 ], [ 2, 1 ], [ 2, 2 ], [ 2, 3 ], [ 3, 1 ], [ 3, 2 ], [ 3, 3 ], [ 1, 1, 1 ], [ 1, 1, 2 ], [ 1, 1, 3 ], [ 1, 2, 1 ], [ 1, 2, 2 ], [ 1, 2, 3 ], [ 1, 3, 1 ], [ 1, 3, 2 ], [ 1, 3, 3 ], [ 2, 1, 1 ], [ 2, 1, 2 ], [ 2, 1, 3 ], [ 2, 2, 1 ], [ 2, 2, 2 ], [ 2, 2, 3 ], [ 2, 3, 1 ], [ 2, 3, 2 ], [ 2, 3, 3 ], [ 3, 1, 1 ], [ 3, 1, 2 ], [ 3, 1, 3 ], [ 3, 2, 1 ], [ 3, 2, 2 ], [ 3, 2, 3 ], [ 3, 3, 1 ], [ 3, 3, 2 ], [ 3, 3, 3 ] ]