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

Function findEffect

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

Source from the content-addressed store, hash-verified

1521 * @since 2.0.0
1522 */
1523export const findEffect = <In, E, R>(
1524 predicate: (input: In) => Effect.Effect<boolean, E, R>
1525): Sink<Option.Option<In>, In, In, E, R> =>
1526 reduceWhileEffect(
1527 Option.none<In>,
1528 Option.isNone,
1529 (acc, in_) => Effect.map(predicate(in_), (b) => b ? Option.some(in_) : acc)
1530 )
1531
1532/**
1533 * 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