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

1.0.4 • Public • Published

array-combination

find all combinations of string arrays

Install

npm install @idw111/array-combination

Quick Start

import { combination } from '@idw111/array-combination';

combination(['a', 'b'], ['1', '2']);
// [['a', '1'], ['a', '2'], ['b', '1'], ['b', '2']]

combination(['a', 'b'], ['1', '2'], ['x', 'y']);
// [['a', '1', 'x'], ['a', '1', 'y'], ['a', '2', 'x'], ['a', '2', 'y'], ['b', '1', 'x'], ['b', '1', 'y'], ['b', '2', 'x'], ['b', '2', 'y']]

combination([1, 2], [{ a: 1 }, { b: 2 }]);
// [[1, { a: 1 }], [1, { b: 2 }], [2, { a: 1 }], [2, { b: 2 }]]

Package Sidebar

Install

npm i @idw111/array-combination

Weekly Downloads

55

Version

1.0.4

License

ISC

Unpacked Size

9.94 kB

Total Files

14

Last publish

Collaborators

  • idw111