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

Function checkEffect

packages/effect/src/SchemaGetter.ts:667–682  ·  view source on GitHub ↗
(
  f: (input: T, options: SchemaAST.ParseOptions) => Effect.Effect<
    undefined | boolean | Schema.FilterIssue,
    never,
    R
  >
)

Source from the content-addressed store, hash-verified

665 * @since 4.0.0
666 */
667export function checkEffect<T, R = never>(
668 f: (input: T, options: SchemaAST.ParseOptions) => Effect.Effect<
669 undefined | boolean | Schema.FilterIssue,
670 never,
671 R
672 >
673): Getter<T, T, R> {
674 return transformEffect((t, options) => {
675 return f(t, options).pipe(Effect.flatMapEager((out) => {
676 const issue = SchemaIssue.makeSingle(out, t, options)
677 return issue ?
678 Effect.fail(issue) :
679 Effect.succeed(t)
680 }))
681 })
682}
683
684/**
685 * Creates a getter that applies a pure function to present values.

Callers

nothing calls this directly

Calls 5

transformEffectFunction · 0.70
pipeMethod · 0.65
failMethod · 0.65
fFunction · 0.50
succeedMethod · 0.45

Tested by

no test coverage detected