snakeCase
Import from @varavel/vdl-plugin-sdk/utils/strings.
Converts a string to snake_case.
The input is tokenized with words, each token is lowercased, and the final
string is joined with underscores. This keeps the behavior aligned with the
shared SDK word-splitting rules.
When upperCase is true, the same tokenization and joining behavior is
preserved but the final tokens are uppercased instead. This is useful for
environment variable names and constant-like identifiers.
Empty or separator-only inputs return an empty string.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
str |
string |
undefined |
String to normalize. |
upperCase |
boolean |
false |
When true, uppercases each token before joining. |
Returns
string
The snake_case representation of str.