MCPcopy Create free account
hub / github.com/effect-app/libs / map_

Function map_

packages/effect-app/src/Set.ts:164–176  ·  view source on GitHub ↗
(E: Equivalence.Equivalence<B>)

Source from the content-addressed store, hash-verified

162 * Projects a Set through a function
163 */
164export function map_<B>(E: Equivalence.Equivalence<B>): <A>(set: Set<A>, f: (x: A) => B) => Set<B> {
165 const elemE = elem_(E)
166 return (set, f) => {
167 const r = new Set<B>()
168 set.forEach((e) => {
169 const v = f(e)
170 if (!elemE(r, v)) {
171 r.add(v)
172 }
173 })
174 return r
175 }
176}
177
178/**
179 * true if all elements match predicate

Callers 3

make_Function · 0.90
mapFunction · 0.85
make_Function · 0.85

Calls 4

elem_Function · 0.85
fFunction · 0.70
forEachMethod · 0.65
addMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…