apps-script-utils 2.1.1 Help

toSnakeCase

function toSnakeCase(value: string, options?: ToSnakeCaseOptions): string;

The kebab-case rules with underscores in place of hyphens: spaces and hyphens become underscores, an underscore is inserted where a lower-case letter meets an upper-case one, and the result is lowered.

clean removes anything that is not a letter, a digit or an underscore; trim collapses the surrounding whitespace first.

Parameters

Parameter

Type

Description

value

string

The string to convert. It must not be empty.

options (optional)

ToSnakeCaseOptions

clean removes the remaining punctuation; trim trims and collapses whitespace.

Returns

string — the converted string.

Throws

Exception

Condition

EmptyStringException

the value is not a string, or is empty.

Examples

Converting

toSnakeCase("Hello World"); // => "hello_world" toSnakeCase("userFirstName"); // => "user_first_name"

See also

Source

src/lang/string/toSnakeCase.ts

23 September 2026

This documentation was generated with AI (Claude) from the library's source code.