MCPcopy Create free account
hub / github.com/Effect-TS/effect / filter

Function filter

packages/effect/src/Micro.ts:3983–3991  ·  view source on GitHub ↗
(iterable: Iterable<A>, f: (a: NoInfer<A>) => Micro<boolean, E, R>, options?: {
  readonly concurrency?: Concurrency | undefined
  readonly negate?: boolean | undefined
})

Source from the content-addressed store, hash-verified

3981 * @category collecting & elements
3982 */
3983export const filter = <A, E, R>(iterable: Iterable<A>, f: (a: NoInfer<A>) => Micro<boolean, E, R>, options?: {
3984 readonly concurrency?: Concurrency | undefined
3985 readonly negate?: boolean | undefined
3986}): Micro<Array<A>, E, R> =>
3987 filterMap(iterable, (a) =>
3988 map(f(a), (pass) => {
3989 pass = options?.negate ? !pass : pass
3990 return pass ? Option.some(a) : Option.none()
3991 }), options)
3992
3993/**
3994 * Effectfully filter the elements of the provided iterable.

Callers 1

stm.tsFile · 0.50

Calls 3

filterMapFunction · 0.85
mapFunction · 0.70
fFunction · 0.70

Tested by

no test coverage detected