UNPKG

@thi.ng/transducers-async

Version:

Async versions of various highly composable transducers, reducers and iterators

20 lines (19 loc) 468 B
import { rename } from "@thi.ng/transducers/rename"; import { comp } from "./comp.js"; import { __iter } from "./iterator.js"; import { multiplex } from "./multiplex.js"; function multiplexObj(...args) { const iter = __iter(multiplexObj, args); if (iter) { return iter; } const [xforms, rfn] = args; const ks = Object.keys(xforms); return comp( multiplex.apply(null, ks.map((k) => xforms[k])), rename(ks, rfn) ); } export { multiplexObj };