import type { IObjectOf , Pair } from "@thi.ng/api" ; import { assocObj } from "./assoc-obj.js" ; import { map } from "./map.js" ; import { mapcat } from "./mapcat.js" ; import { pairs } from "./pairs.js" ; import { partition } from "./partition.js" ; import { permutations } from "./permutations.js" ; /**
 * 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 example param spec export const keyPermutations = < T extends IObjectOf < any [ ] > > ( spec ) : IterableIterator < { [ k in keyof T ] : T [ k ] [ 0 ] ; } > => < any > ( map ( ( x ) => assocObj ( < Iterable < Pair < string , any > > > partition ( 2 , x ) ) , permutations ( ... mapcat ( ( [ k , v ] ) => [ [ k ] , v ] , pairs ( spec ) ) ) ) ) ;