/** * Chains over the values of the `HashMap` using the specified function. * * **NOTE**: the hash and equal of both maps have to be the same. * * @tsplus static HashMap.Aspects flatMap * @tsplus pipeable HashMap flatMap */ export function flatMap(f: (v: V) => HashMap) { return (self: HashMap): HashMap => self.reduceWithIndex(HashMap.empty(), (z, _, v) => z.mutate((m) => { f(v).forEachWithIndex((_k, _a) => { m.set(_k, _a) }) })) }