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

Replace some Array.prototype-usage with spread syntax

We have a few, quite old, call-sites that use the `Array.prototype`-format and which can now be replaced with spread syntax instead.
This commit is contained in:
Jonas Jenwald 2022-09-23 09:35:30 +02:00
parent 91bdcd8b20
commit 6538409282
3 changed files with 6 additions and 17 deletions

View file

@ -523,9 +523,7 @@ class PostScriptStack {
}
constructor(initialStack) {
this.stack = !initialStack
? []
: Array.prototype.slice.call(initialStack, 0);
this.stack = initialStack ? Array.from(initialStack) : [];
}
push(value) {
@ -1201,10 +1199,7 @@ class PostScriptCompiler {
if (j === 0) {
break; // just skipping -- there are nothing to rotate
}
Array.prototype.push.apply(
stack,
stack.splice(stack.length - n, n - j)
);
stack.push(...stack.splice(stack.length - n, n - j));
break;
default:
return null; // unsupported operator