mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-04-19 11:44:07 +02:00
Remove manual loops in the StatTimer.prototype.toString method
We can use Array methods instead, which is a tiny bit shorter.
This commit is contained in:
parent
522f5f85b9
commit
256be7f3a6
@ -443,15 +443,11 @@ class StatTimer {
|
||||
|
||||
toString() {
|
||||
// Find the longest name for padding purposes.
|
||||
const outBuf = [];
|
||||
let longest = 0;
|
||||
for (const { name } of this.times) {
|
||||
longest = Math.max(name.length, longest);
|
||||
}
|
||||
for (const { name, start, end } of this.times) {
|
||||
outBuf.push(`${name.padEnd(longest)} ${end - start}ms\n`);
|
||||
}
|
||||
return outBuf.join("");
|
||||
const longest = Math.max(...this.times.map(t => t.name.length));
|
||||
|
||||
return this.times
|
||||
.map(t => `${t.name.padEnd(longest)} ${t.end - t.start}ms\n`)
|
||||
.join("");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user