Similar to permutations, however takes an object with each key specifying an array of its possible values. Yields an iterable of objects of all value permutations.
remarks
The resulting object type will be derived from the value types in the given spec object.
The order of resulting permutations is not guaranteed and depending on the VM's iteration behavior of Object.keys().
Similar to permutations, however takes an object with each key specifying an array of its possible values. Yields an iterable of objects of all value permutations.
The resulting object type will be derived from the value types in the given
spec
object.The order of resulting permutations is not guaranteed and depending on the VM's iteration behavior of
Object.keys()
.[...keyPermutations({ a: [1, 2], b: [true, false], c: ["X", "Y"] })] // [ // { a: 1, b: true, c: 'X' }, // { a: 1, b: true, c: 'Y' }, // { a: 1, b: false, c: 'X' }, // { a: 1, b: false, c: 'Y' }, // { a: 2, b: true, c: 'X' }, // { a: 2, b: true, c: 'Y' }, // { a: 2, b: false, c: 'X' }, // { a: 2, b: false, c: 'Y' } // ]