GuobaGuoba Utils

snake

@guoba-ai/utils / string / snake

Function: snake()

function snake(str): string;

Defined in: string.ts:132

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'

On this page