UNPKG

@thi.ng/associative

Version:

ES Map/Set-compatible implementations with customizable equality semantics & supporting operations

11 lines (10 loc) 310 B
import { reduce } from "@thi.ng/transducers/reduce"; import { ensureSet } from "../checks.js"; const __combineSet = (rfn, op, src) => src ? reduce(rfn(), src) : [ () => null, (acc) => acc || /* @__PURE__ */ new Set(), (acc, x) => !acc ? ensureSet(x) : op(acc, ensureSet(x)) ]; export { __combineSet };