toSnakeCase
Creates a to snake case transformation action.
Words are separated by _, - and ASCII whitespace, as well as by case and acronym boundaries.
Acronym runs are normalized to lowercase (e.g.
parseURLValue→parse_url_value) and digits stay attached to the preceding token (e.g.item2Name→item2_name).
const Action = v.toSnakeCase();
Returns
ActionToSnakeCaseAction
Examples
The following examples show how toSnakeCase can be used.
Snake case string
Schema that transforms a string to snake case.
const StringSchema = v.pipe(v.string(), v.toSnakeCase());
Related
The following APIs can be combined with toSnakeCase.
Schemas
Methods
Utils
© Fabian Hiller
Licensed under the MIT License.
https://valibot.dev/api/toSnakeCase/