Package: effect
Module: SchemaTransformation
Transforms strings by trimming whitespace on decode. Encode is passthrough (no change).
When to use
Use when you need a schema transformation to normalize user input by stripping leading/trailing whitespace.
Details
Decoding applies String.prototype.trim(). Encoding is passthrough and
returns the string unchanged. This is not round-trippable if the original had
whitespace.
Example (Trimming on decode)
import { Schema, SchemaTransformation } from "effect"
const Trimmed = Schema.String.pipe(
Schema.decode(SchemaTransformation.trim())
)
See
toLowerCasetoUpperCasesnakeToCamelSignature
declare const trim: () => Transformation<string, string>
Since v4.0.0