Skip to content

Instantly share code, notes, and snippets.

@daanta-real
Last active April 11, 2023 03:15
Show Gist options
  • Save daanta-real/7760006918173b4d2ca0422d14cd9f09 to your computer and use it in GitHub Desktop.
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
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