1.0.3 • Published 3 years ago

@nguyenphutrong/array-combination v1.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

array-combination

All the possibilities of a free combinatorial array

Install

npm i @nguyenphutrong/array-combination

Usage

import { arrayCombination } from '@nguyenphutrong/array-combination';

const options = [
    ['a', 'b', 'c'],
    ['1', '2', '3', '4']
];

const variants = arrayCombination(options);

console.log(variants);

Output:

[
  [ 'a', '1' ], [ 'b', '1' ],
  [ 'c', '1' ], [ 'a', '2' ],
  [ 'b', '2' ], [ 'c', '2' ],
  [ 'a', '3' ], [ 'b', '3' ],
  [ 'c', '3' ], [ 'a', '4' ],
  [ 'b', '4' ], [ 'c', '4' ]
]
1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago