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

Function toOption

packages/effect/src/Filter.ts:812–818  ·  view source on GitHub ↗
(
  self: Filter<A, Pass, Fail>
)

Source from the content-addressed store, hash-verified

810 * @since 4.0.0
811 */
812export const toOption = <A, Pass, Fail>(
813 self: Filter<A, Pass, Fail>
814): (input: A) => Option.Option<Pass> =>
815(input: A) => {
816 const result = self(input)
817 return Result.isFailure(result) ? Option.none() : Option.some(result.success)
818}
819
820/**
821 * Converts a `Filter` into a function that returns the underlying

Callers

nothing calls this directly

Calls 2

selfFunction · 0.85
someMethod · 0.80

Tested by

no test coverage detected