GuobaGuoba Utils

snake

@guoba-ai/utils / string / snake

Function: snake()

function snake(str): string;

Defined in: string.ts:138

Convert a string to snake_case.

Parameters

str

string

The string to convert

Returns

string

The snake_case version of the string

Example

snake('fooBar') // 'foo_bar'

snake('FooBar') // 'foo_bar'

snake('foo-bar') // 'foo_bar'

snake('HTMLParser') // 'html_parser'

Warning

Conversion follows the current word-splitting rules for separators, casing, and acronyms.

On this page