diff --git a/deemix/utils/index.js b/deemix/utils/index.js index 9e0236f..f765e82 100644 --- a/deemix/utils/index.js +++ b/deemix/utils/index.js @@ -25,9 +25,13 @@ function changeCase(txt, type){ case 'upper': return txt.toUpperCase() case 'start': txt = txt.split(" ") - for (let i = 0, q = 0; i < txt.length; i++) - if (txt[i].substr(0, 1) === "(" || txt[i].substr(0, 1) === "[" || txt[i].substr(0, 1) === "{") q++; - txt[i] = txt[i][q].toUpperCase() + txt[i].substr(q + 1).toLowerCase() + for (let i = 0; i < txt.length; i++) { + if (txt[i].startsWith("(") || txt[i].startsWith("[") || txt[i].startsWith("{")) { + txt[i] = txt[i][0] + txt[i][1].toUpperCase() + txt[i].substr(2).toLowerCase() + } else { + txt[i] = txt[i][0].toUpperCase() + txt[i].substr(1).toLowerCase() + } + } return txt.join(" ") case 'sentence': return txt.charAt(0).toUpperCase() + txt.slice(1).toLowerCase() default: return txt