effect-io-ai

Package: effect
Module: SchemaTransformation

SchemaTransformation.snakeToCamel

Transforms strings by converting snake_case to camelCase on decode and camelCase to snake_case on encode.

When to use

Use when you need a schema transformation to convert API field names between snake_case and camelCase conventions.

Details

Decoding converts values such as "my_field_name" to "myFieldName". Encoding converts values such as "myFieldName" back to "my_field_name". The transformation is round-trippable for standard snake_case and camelCase.

Example (Converting snake case to camel case)

import { Schema, SchemaTransformation } from "effect"

const SnakeToCamel = Schema.String.pipe(
  Schema.decode(SchemaTransformation.snakeToCamel())
)

See

Signature

declare const snakeToCamel: () => Transformation<string, string>

Source

Since v4.0.0