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

Function findEffect

packages/effect/src/Sink.ts:1598–1605  ·  view source on GitHub ↗
(
  predicate: (input: In) => Effect.Effect<boolean, E, R>
)

Source from the content-addressed store, hash-verified

1596 * @since 2.0.0
1597 */
1598export const findEffect = <In, E, R>(
1599 predicate: (input: In) => Effect.Effect<boolean, E, R>
1600): Sink<Option.Option<In>, In, In, E, R> =>
1601 reduceWhileEffect(
1602 Option.none<In>,
1603 Option.isNone,
1604 (acc, in_) => Effect.map(predicate(in_), (b) => b ? Option.some(in_) : acc)
1605 )
1606
1607/**
1608 * Creates a sink which sums up its inputs.

Callers

nothing calls this directly

Calls 4

reduceWhileEffectFunction · 0.85
predicateFunction · 0.85
someMethod · 0.80
mapMethod · 0.45

Tested by

no test coverage detected