Skip to content

Commit

Permalink
Move breaking out of loop if notfoundregex meets threshold.
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeWannacott committed May 13, 2023
1 parent 6e7bd58 commit 6738576
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions public/table-sort.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
let tableColumnLength = th.parentElement.childElementCount;
const threshold = Math.floor(tableColumnLength / 2);
for (let tr of tableRows) {
if (regexNotFoundCount >= threshold) {
break;
}
let matches = {
runtime: null,
filesize: null,
Expand All @@ -89,9 +92,6 @@ function tableSortJs(testingTableSortJS = false, domDocumentWindow = document) {
matches.dmyDates = tableColumn.innerText.match(datesRegex);
matches.ymdDates = tableColumn.innerText.match(regexISODates);
}
if (regexNotFoundCount >= threshold) {
break;
}
if (Object.values(matches).every((match) => match === null)) {
regexNotFoundCount++;
continue;
Expand Down

0 comments on commit 6738576

Please sign in to comment.