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

Function fromPredicate

repos/effect/packages/effect/src/internal/hashSet.ts:105–113  ·  view source on GitHub ↗
(self: HashSet<V>, predicate: (value: V) => boolean)

Source from the content-addressed store, hash-verified

103
104// Helper function for building new HashSets from iteration
105const fromPredicate = <V>(self: HashSet<V>, predicate: (value: V) => boolean): HashSet<V> => {
106 let result = HashMap.empty<V, boolean>()
107 for (const value of self) {
108 if (predicate(value)) {
109 result = HashMap.set(result, value, true)
110 }
111 }
112 return makeImpl(result)
113}
114
115/** @internal */
116export const union = <V0, V1>(self: HashSet<V0>, that: HashSet<V1>): HashSet<V0 | V1> => {

Callers 2

differenceFunction · 0.70
filterFunction · 0.70

Calls 3

predicateFunction · 0.85
makeImplFunction · 0.70
setMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…