mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 17:55:37 +02:00
Reduce unnecessary usage of Array.prototype.concat()
There are obviously cases where using `concat` makes perfect sense, since that method doesn't change any of the existing Arrays; see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat However, in a few cases throughout the code-base that's not an issue and using `concat` only leads to unnecessary intermediate allocations. With modern JavaScript we can thus replace those with a combination of `push` and spread-syntax, which wasn't originally possible when the code was written.
This commit is contained in:
parent
f516bb2174
commit
c21f4faaf8
4 changed files with 21 additions and 23 deletions
|
@ -547,10 +547,7 @@ function expandBoundsLTR(width, bounds) {
|
|||
}
|
||||
}
|
||||
|
||||
Array.prototype.splice.apply(
|
||||
horizon,
|
||||
[i, j - i + 1].concat(changedHorizon)
|
||||
);
|
||||
Array.prototype.splice.apply(horizon, [i, j - i + 1, ...changedHorizon]);
|
||||
}
|
||||
|
||||
// Set new x2 for all unset boundaries.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue