We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ee3c9e7 commit 9c047c7Copy full SHA for 9c047c7
6kyus/js/convertStringToCamelCase.js
@@ -14,6 +14,14 @@ function toCamelCase(str) {
14
return word
15
})
16
return returnString.join('')
17
+ } else if (str.includes('_')) {
18
+ returnString = str.split('_').map((word, idx) => {
19
+ if (idx > 0) {
20
+ return `${word.charAt(0).toUpperCase()}${word.slice(1)}`
21
+ }
22
+ return word
23
+ })
24
+ return returnString.join('')
25
}
26
// Split on dash or underscore
27
// loop over each element in array and capitalize first character starting from index 1
0 commit comments