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

Function find

packages/effect/src/Sink.ts:1497–1502  ·  view source on GitHub ↗
(predicate: Predicate<In>)

Source from the content-addressed store, hash-verified

1495 <In, Out extends In>(refinement: Refinement<In, Out>): Sink<Option.Option<Out>, In, In>
1496 <In>(predicate: Predicate<In>): Sink<Option.Option<In>, In, In>
1497} = <In>(predicate: Predicate<In>): Sink<Option.Option<In>, In, In> =>
1498 reduceWhile(
1499 Option.none<In>,
1500 Option.isNone,
1501 (acc, in_) => predicate(in_) ? Option.some(in_) : acc
1502 )
1503
1504/**
1505 * Creates a sink containing the first value matched by an effectful predicate.

Callers

nothing calls this directly

Calls 3

reduceWhileFunction · 0.85
predicateFunction · 0.85
someMethod · 0.80

Tested by

no test coverage detected