A simple library to convert strings to snake_case.
Install via npm:
npm install simple-str-to-snake-case
const toSnakeCase = require('simple-str-to-snake-case');
console.log(toSnakeCase('Hello World')); // Output: hello_world
console.log(toSnakeCase('helloWorld')); // Output: hello_world
console.log(toSnakeCase('Hello, World!')); // Output: hello_world
-
str:
string
- The input string to be converted to snake_case. -
Returns:
string
- The snake_case version of the input string.