Converts a string to snake_case by replacing spaces and punctuation with underscores. Uses kebab() internally, replacing hyphens with underscores.
snake_case
kebab()
This is null | undefined safe. If you pass null | undefined then this will return "".
null | undefined
""
snake(null); // ""snake("Hello World"); // "hello_world"snake("User-Profile Page"); // "user_profile_page" Copy
snake(null); // ""snake("Hello World"); // "hello_world"snake("User-Profile Page"); // "user_profile_page"
Converts a string to
snake_case
by replacing spaces and punctuation with underscores. Useskebab()
internally, replacing hyphens with underscores.