composebox_typeahead: Remove unnecessary string operation.

slice always returns a new string, so this could have been motivated
by ensuring we always duplicate the string, but reading the code, it's
already sliced by the caller.
This commit is contained in:
Pragati Agrawal 2019-03-19 09:00:28 +05:30 committed by Tim Abbott
parent f617008924
commit 2e67cf38b3
1 changed files with 2 additions and 2 deletions

View File

@ -328,7 +328,7 @@ exports.tokenize_compose_str = function (s) {
case '~':
// Code block must start on a new line
if (i === 2) {
return s.slice(0);
return s;
} else if (i > 2 && s[i - 3] === "\n") {
return s.slice(i - 2);
}
@ -343,7 +343,7 @@ exports.tokenize_compose_str = function (s) {
case ':':
case '_':
if (i === 0) {
return s.slice(i);
return s;
} else if (/[\s(){}\[\]]/.test(s[i - 1])) {
return s.slice(i);
}