1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 06:38:07 +02:00

Use arrow function with various Array methods

A lot of this is quite old code, which we can shorten slightly by using arrow functions instead of "regular" functions.
This commit is contained in:
Jonas Jenwald 2025-03-02 14:48:08 +01:00
parent 7081a1f112
commit 2e62f426fe
10 changed files with 16 additions and 46 deletions

View file

@ -398,9 +398,7 @@ class Stepper {
}
getNextBreakPoint() {
this.breakPoints.sort(function (a, b) {
return a - b;
});
this.breakPoints.sort((a, b) => a - b);
for (const breakPoint of this.breakPoints) {
if (breakPoint > this.currentIdx) {
return breakPoint;
@ -487,9 +485,7 @@ const Stats = (function Stats() {
statsDiv.textContent = stat.toString();
wrapper.append(title, statsDiv);
stats.push({ pageNumber, div: wrapper });
stats.sort(function (a, b) {
return a.pageNumber - b.pageNumber;
});
stats.sort((a, b) => a.pageNumber - b.pageNumber);
clear(this.panel);
for (const entry of stats) {
this.panel.append(entry.div);