DEV: tiny refactor in watched words (#12969)

This commit is contained in:
Penar Musaraj 2021-05-06 11:37:05 -04:00 committed by GitHub
parent b61d4663ec
commit 82ecd9fdd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 4 deletions

View File

@ -11,16 +11,14 @@ function findAllMatches(text, matchers, useRegExp) {
if (useRegExp) {
const maxMatches = 100;
let index = 0;
let count = 0;
matchers.forEach((matcher) => {
let match;
while (
(match = matcher.pattern.exec(text)) !== null &&
index < maxMatches
count++ < maxMatches
) {
index++;
matches.push({
index: match.index,
text: match[0],