Package: effect
Module: SchemaGetter
Creates a getter that handles present values (Option.Some), passing None through.
When to use
Use when you need a schema getter to transform or validate only when a field value is present.
Details
None, returns None (no-op).Some(e), calls f(e, options) to produce the result.f may return None to omit the value, or fail with an Issue.Example (Transforming only present values)
import { Effect, Option, SchemaGetter } from "effect"
const parseIfPresent = SchemaGetter.onSome<number, string>(
(s) => Effect.succeed(Option.some(Number(s)))
)
See
onNone to handle only absent valuestransform for a simpler pure transformation of present valuestransformOrFail for fallible transformation of present valuesSignature
declare const onSome: <T, E, R = never>(f: (e: E, options: SchemaAST.ParseOptions) => Effect.Effect<Option.Option<T>, SchemaIssue.Issue, R>) => Getter<T, E, R>
Since v4.0.0