Last active
June 3, 2025 13:03
-
-
Save andrea-buzz/d34701f6a33f80659bff6c83489a6cd9 to your computer and use it in GitHub Desktop.
js toCamelCase function regex based
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String.prototype.toCamelCase = function() {return this.replace(/[\s\._-]+\w/g, (m) => m[m.length-1].toUpperCase())} | |
function toCamelCase(str) { | |
return str.replace(/[\s\._-]+\w/g, (m) => m[m.length-1].toUpperCase()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
fixed some bugs