import {crossProduct} from '@augment-vir/common';
const result = crossProduct({
a: [
1,
2,
3,
],
b: [
'a',
'b',
'c',
],
});
// result is:
// [
// {a: 1, b: 'a'}, {a: 2, b: 'a'}, {a: 3, b: 'a'},
// {a: 1, b: 'b'}, {a: 2, b: 'b'}, {a: 3, b: 'b'},
// {a: 1, b: 'c'}, {a: 2, b: 'c'}, {a: 3, b: 'c'},
// ]
Creates the cartesian product (cross product) of an object whose values are arrays. The result is an array of objects where each object contains one picked value from every input array.