combinatorial
Given n arrays, iterate over all possible combinations of values by taking a single value from each array.
Last updated 5 years ago by bluejeansandrain .
MIT · Repository · Bugs · Original npm · Tarball · package.json
`\$ cnpm install combinatorial `
SYNC missed versions from official npm registry.

# combinatorial

Given n arrays, iterate over all possible combinations of values by taking a single value from each array.

## Example

``````const combinatorial = require("combinatorial");

const a = [1, 2, 3];
const b = ['a', 'b', 'c'];
const c = ['A', 'B', 'C'];
const result = [];

combinatorial(a, b, c, (a, b, c) => {
result.push([a, b, c]);
});

// result will be the following:
[
[1, 'a', 'A'], [1, 'a', 'B'], [1, 'a', 'C'],
[1, 'b', 'A'], [1, 'b', 'B'], [1, 'b', 'C'],
[1, 'c', 'A'], [1, 'c', 'B'], [1, 'c', 'C'],
[2, 'a', 'A'], [2, 'a', 'B'], [2, 'a', 'C'],
[2, 'b', 'A'], [2, 'b', 'B'], [2, 'b', 'C'],
[2, 'c', 'A'], [2, 'c', 'B'], [2, 'c', 'C'],
[3, 'a', 'A'], [3, 'a', 'B'], [3, 'a', 'C'],
[3, 'b', 'A'], [3, 'b', 'B'], [3, 'b', 'C'],
[3, 'c', 'A'], [3, 'c', 'B'], [3, 'c', 'C']
]
``````

## Current Tags

• 1.0.3                                ...           latest (5 years ago)

## 4 Versions

• 1.0.3                                ...           5 years ago
• 1.0.2                                ...           5 years ago
• 1.0.1                                ...           5 years ago
• 1.0.0                                ...           5 years ago
Maintainers (1)
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (2)
Dependents (0)
None