/** * Applies the specified predicate to each entry of the map, filitering out any * values that do not satisfy the predicate. * * @tsplus static ImmutableMap.Aspects filter * @tsplus pipeable ImmutableMap filter */ export function filter( f: Refinement ): (self: ImmutableMap) => ImmutableMap export function filter( f: Predicate ): (self: ImmutableMap) => ImmutableMap export function filter(f: Predicate) { return (self: ImmutableMap): ImmutableMap => { const map = new Map() for (const [key, value] of self.internalMap) { if (f(value)) { map.set(key, value) } } return new ImmutableMap(map) } }