Keymbinatorial
Generates the unique combinations of key values by taking a single value from each keys array
Usage
npm install keymbinatorial
var keymbinatorial = require('keymbinatorial');
let objectToCombine = {
a: ['a', 'b', 'c'],
c: [1, 2],
e: [{ a: '1'}, {b: '2'}]
};
let combinations = keymbinatorial(objectToCombine);
console.log(combinations);
The keymbinatorial
function takes in an Nx1 object, where N is a set of keys that map to
an array.
For each key in the object, the function builds up a list of objects containing a unique combination
of keys to values in the array.
Testing
npm test
License
Code licensed under the BSD 3-Clause license. See LICENSE file for terms.