Skip to content

Commit f395042

Browse files
Merge pull request #20692 from Snuffleupagus/debugger-findIndex
Replace the `getStatIndex` helper, in `web/debugger.mjs`, with native functionality
2 parents e87019e + 06e7f30 commit f395042

1 file changed

Lines changed: 2 additions & 10 deletions

File tree

web/debugger.mjs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -677,14 +677,6 @@ const Stats = (function Stats() {
677677
function clear(node) {
678678
node.textContent = ""; // Remove any `node` contents from the DOM.
679679
}
680-
function getStatIndex(pageNumber) {
681-
for (const [i, stat] of stats.entries()) {
682-
if (stat.pageNumber === pageNumber) {
683-
return i;
684-
}
685-
}
686-
return false;
687-
}
688680
return {
689681
// Properties/functions needed by PDFBug.
690682
id: "Stats",
@@ -699,8 +691,8 @@ const Stats = (function Stats() {
699691
if (!stat) {
700692
return;
701693
}
702-
const statsIndex = getStatIndex(pageNumber);
703-
if (statsIndex !== false) {
694+
const statsIndex = stats.findIndex(s => s.pageNumber === pageNumber);
695+
if (statsIndex !== -1) {
704696
stats[statsIndex].div.remove();
705697
stats.splice(statsIndex, 1);
706698
}

0 commit comments

Comments
 (0)