SchemaTransformation44
Constructors
makeconstConstructs a Transformation from an object with decode and encode Getters.passthroughfunctionTransforms values by returning the input unchanged in both directions.passthroughSubtypefunctionTransforms values without changing them, typed so that E extends T — the encoded type is a subtype of the decoded type.passthroughSupertypefunctionTransforms values without changing them, typed so that T extends E, where the decoded type T is a subtype of the encoded type E.transformfunctionCreates a Transformation from pure (sync, infallible) decode and encode functions.transformOptionalfunctionCreates a Transformation where decode and encode operate on Option values, giving full control over missing-key handling.transformOrFailfunctionCreates a Transformation from effectful decode and encode functions that can fail with Issue.Models
Guards
Coercions
bigintFromStringconstDecodes a string into a bigint and encodes a bigint back to a string.dateFromMillisconstDecodes epoch milliseconds into a Date and encodes a Date back to epoch milliseconds.dateFromStringconstDecodes a string into a Date and encodes a Date back to a string.numberFromStringconstDecodes a string into a number and encodes a number back to a string.Decoding
fromFormDataconstDecodes a FormData instance into a nested record using bracket-path keys and encodes object-like values back into FormData.fromJsonStringconstDecodes a JSON string with JSON.parse and encodes a value with JSON.stringify.fromURLSearchParamsconstDecodes URLSearchParams into a nested record using bracket-path keys and encodes object-like values back into URLSearchParams.Encoding
stringFromBase64StringconstDecodes a Base64-encoded string into a UTF-8 string and encodes a UTF-8 string back to a Base64 string.stringFromBase64UrlStringconstDecodes a base64 (URL) encoded string into a UTF-8 string and encodes it back.stringFromHexStringconstDecodes a hex encoded string into a UTF-8 string and encodes it back.stringFromUriComponentconstDecodes a URI component encoded string into a UTF-8 string and encodes a UTF-8 string into a URI component encoded string.uint8ArrayFromBase64StringconstDecodes a Base64-encoded string into a Uint8Array and encodes a Uint8Array back to a Base64 string.String Transformations
capitalizefunctionTransforms strings by capitalizing the first character on decode.snakeToCamelfunctionTransforms strings by converting snake_case to camelCase on decode and camelCase to snake_case on encode.splitKeyValuefunctionTransforms a string into a record of key-value pairs and encodes a record of key-value pairs into a string.toLowerCasefunctionTransforms strings by lowercasing on decode.toUpperCasefunctionTransforms strings by uppercasing on decode.trimfunctionTransforms strings by trimming whitespace on decode.uncapitalizefunctionTransforms strings by lowercasing the first character on decode.Transforming
bigDecimalFromStringconstDecodes a string into a BigDecimal and encodes a BigDecimal back to its string representation.dateTimeUtcFromStringconstDecodes a date-time string into a DateTime.Utc and encodes it back to an ISO string.dateTimeZonedFromStringconstDecodes a zoned date-time string into a DateTime.Zoned and encodes it back to an ISO zoned string.durationFromMillisconstDecodes a number of milliseconds into a Duration and encodes a Duration back to milliseconds.durationFromNanosconstDecodes a bigint (nanoseconds) into a Duration and encodes a Duration back to bigint nanoseconds.durationFromStringconstDecodes a string into a Duration and encodes a Duration back to a parseable string.optionFromNullishOrfunctionDecodes T | null | undefined into Option<T> and encodes Option<T> back to T | null or T | undefined depending on the provided options.onNoneEncoding (defaults to undefined).optionFromNullOrfunctionDecodes T | null into Option<T> and encodes Option<T> back to T | null.optionFromOptionalfunctionDecodes optional values into Option<T> and encodes Option.none() back to an omitted optional value.optionFromOptionalKeyfunctionDecodes an optional struct key into Option<T> and encodes Option<T> back to an optional key.optionFromUndefinedOrfunctionDecodes T | undefined into Option<T> and encodes Option.none() back to undefined.timeZoneFromStringconstDecodes a string into a DateTime.TimeZone and encodes a time zone back to its string representation.timeZoneNamedFromStringconstDecodes an IANA time-zone identifier string into a DateTime.TimeZone.Named and encodes a named time zone back to its id.timeZoneOffsetFromNumberconstDecodes a numeric time-zone offset in milliseconds into a DateTime.TimeZone.Offset and encodes it back to the offset number.urlFromStringconstDecodes a string into a URL and encodes a URL back to its href string.