Created
September 11, 2018 20:36
-
-
Save simplyspoke/3fbc69e64a4648929da8d8c719d124f9 to your computer and use it in GitHub Desktop.
camelCase to _CapCase
This file contains 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
const value = 'SomeThingHere' | |
.replace('Command', '') | |
.replace(/([A-Z])/g, c => { | |
console.log(c) | |
return `_${c}`; | |
}) | |
.replace(/^\w/, c => c.toUpperCase()); | |
console.log(value); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment