Code Cleanup

cleaned up the if condition
This commit is contained in:
Jera 2021-09-01 01:59:10 -04:00
parent 8125a31fce
commit c7dd1a0c70

View file

@ -26,7 +26,7 @@ function changeCase(txt, type){
case 'start': case 'start':
txt = txt.split(" ") txt = txt.split(" ")
for (let i = 0; i < txt.length; i++) { for (let i = 0; i < txt.length; i++) {
if (txt[i].startsWith("(") || txt[i].startsWith("[") || txt[i].startsWith("{")) { if (bracket = ['(', '{', '['].some(bracket => txt[i].startsWith(bracket))) {
txt[i] = txt[i][0] + txt[i][1].toUpperCase() + txt[i].substr(2).toLowerCase() txt[i] = txt[i][0] + txt[i][1].toUpperCase() + txt[i].substr(2).toLowerCase()
} else { } else {
txt[i] = txt[i][0].toUpperCase() + txt[i].substr(1).toLowerCase() txt[i] = txt[i][0].toUpperCase() + txt[i].substr(1).toLowerCase()