Skip to content

Commit 4d899f9

Browse files
authored
Merge pull request #1346 from logicplace/patch-1
Change bad uses of substr to substring
2 parents 77308b8 + e245217 commit 4d899f9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/highlight.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ https://highlightjs.org/
192192

193193
while (original.length || highlighted.length) {
194194
var stream = selectStream();
195-
result += escape(value.substr(processed, stream[0].offset - processed));
195+
result += escape(value.substring(processed, stream[0].offset));
196196
processed = stream[0].offset;
197197
if (stream === original) {
198198
/*
@@ -378,7 +378,7 @@ https://highlightjs.org/
378378
match = top.lexemesRe.exec(mode_buffer);
379379

380380
while (match) {
381-
result += escape(mode_buffer.substr(last_index, match.index - last_index));
381+
result += escape(mode_buffer.substring(last_index, match.index));
382382
keyword_match = keywordMatch(top, match);
383383
if (keyword_match) {
384384
relevance += keyword_match[1];
@@ -515,7 +515,7 @@ https://highlightjs.org/
515515
match = top.terminators.exec(value);
516516
if (!match)
517517
break;
518-
count = processLexeme(value.substr(index, match.index - index), match[0]);
518+
count = processLexeme(value.substring(index, match.index), match[0]);
519519
index = match.index + count;
520520
}
521521
processLexeme(value.substr(index));

0 commit comments

Comments
 (0)