Skip to content

Instantly share code, notes, and snippets.

View sojs-coder's full-sized avatar
💭
coding

Matthieu Fuller sojs-coder

💭
coding
View GitHub Profile
@schrodervictor
schrodervictor / uncamelize.js
Last active July 9, 2025 17:16 — forked from jpetitcolas/uncamelize.js
How to uncamelize a string in Javascript? Example: "HelloWorld" --> "hello_world"
/**
* Uncamelize a string, joining the words by separator character.
*
* @param {string} text - Text to uncamelize
* @param {string} [separator='_'] - Word separator
* @returns {string} Uncamelized text
*/
function uncamelize(text, separator) {
// Assume separator is _ if no one has been provided.
if('undefined' === typeof separator) {