Function default

Converts string to snake case.

3.0.0

camelCase, lowerCase, kebabCase, startCase, upperCase, upperFirst

snakeCase('Foo Bar')
// => 'foo_bar'

snakeCase('fooBar')
// => 'foo_bar'

snakeCase('--FOO-BAR--')
// => 'foo_bar'

snakeCase('foo2bar')
// => 'foo_2_bar'
  • Parameters

    • Optionalstring: any

      The string to convert.

    Returns string

    Returns the snake cased string.