Last active
April 11, 2023 03:15
-
-
Save daanta-real/7760006918173b4d2ca0422d14cd9f09 to your computer and use it in GitHub Desktop.
Convert DB column name to camelCase for using their names in VO
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
function toCamelCase(str){ | |
var regExp=/[-_]\w/ig; | |
return str.toLowerCase().replace(regExp,function(match){ | |
return match.charAt(1).toUpperCase(); | |
}); | |
} | |
function toCamelCaseList(arr) { | |
let result = []; | |
arr = arr.split("\n"); | |
for(var a of arr) { | |
console.log(`a = ${a}`); | |
result.push(toCamelCase(a)); | |
} | |
return result; | |
} | |
toCamelCaseList(`문장`); | |
console.table(toCamelCaseList(`문장`)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment