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

Function fromPredicateOption

packages/effect/src/Filter.ts:243–246  ·  view source on GitHub ↗
(predicate: (a: A) => Option.Option<B>)

Source from the content-addressed store, hash-verified

241 * @since 4.0.0
242 */
243export const fromPredicateOption = <A, B>(predicate: (a: A) => Option.Option<B>): Filter<A, B> => (input) => {
244 const o = predicate(input)
245 return o._tag === "None" ? Result.fail(input) : Result.succeed(o.value)
246}
247
248/**
249 * Converts a Filter into a predicate function.

Callers

nothing calls this directly

Calls 3

predicateFunction · 0.85
failMethod · 0.45
succeedMethod · 0.45

Tested by

no test coverage detected