@pmun/utils / snakeCase
Function: snakeCase()
ts
function snakeCase(str): string;将字符串转换为蛇形命名(snake_case)
Parameters
str
string
输入字符串
Returns
string
蛇形命名的字符串
Example
ts
snakeCase('helloWorld') // 'hello_world'
snakeCase('HelloWorld') // 'hello_world'
snakeCase('hello-world') // 'hello_world'
snakeCase('hello world') // 'hello_world'
snakeCase('HelloWorldFoo') // 'hello_world_foo'