diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-11-15 11:59:13 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-11-15 11:59:13 -0800 |
commit | 805e206704517118e55fb3a0097971876a43d759 (patch) | |
tree | 5b4d35edf995031a4edd499391c193a8bd636981 /src/intertyper.js | |
parent | d54af79b81f8fd8a08e9d899d49b5b77b7190173 (diff) |
use test in makeToken as a minor optimization
Diffstat (limited to 'src/intertyper.js')
-rw-r--r-- | src/intertyper.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/intertyper.js b/src/intertyper.js index fbad353a..f7811444 100644 --- a/src/intertyper.js +++ b/src/intertyper.js @@ -165,7 +165,7 @@ function intertyper(data, sidePass, baseLineNums) { function makeToken(text) { if (text.length == 0) return; // merge certain tokens - if (lastToken && ( (lastToken.text == '%' && text[0] == '"') || /^\**$/.exec(text) ) ) { + if (lastToken && ( (lastToken.text == '%' && text[0] == '"') || /^\**$/.test(text) ) ) { lastToken.text += text; return; } @@ -182,7 +182,7 @@ function intertyper(data, sidePass, baseLineNums) { // merge certain tokens if (lastToken && isType(lastToken.text) && isFunctionDef(token)) { lastToken.text += ' ' + text; - } else if (lastToken && /^}\**$/.exec(text)) { // }, }*, etc. + } else if (lastToken && /^}\**$/.test(text)) { // }, }*, etc. var openBrace = tokens.length-1; while (tokens[openBrace].text.substr(-1) != '{') openBrace --; token = combineTokens(tokens.slice(openBrace+1)); |