MCPcopy
hub / github.com/Effect-TS/effect / filter

Function filter

packages/effect/src/Micro.ts:3982–3990  ·  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

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