Use more for...of loops in the code-base

Most, if not all, of this code is old enough to predate the general availability of `for...of` iteration.
This commit is contained in:
Jonas Jenwald 2022-10-03 12:33:49 +02:00
parent 4e58dabb32
commit 60f6272ed9
16 changed files with 70 additions and 101 deletions

View file

@ -187,9 +187,9 @@ class PDFFunction {
}
const fnArray = [];
for (let j = 0, jj = fnObj.length; j < jj; j++) {
for (const fn of fnObj) {
fnArray.push(
this.parse({ xref, isEvalSupported, fn: xref.fetchIfRef(fnObj[j]) })
this.parse({ xref, isEvalSupported, fn: xref.fetchIfRef(fn) })
);
}
return function (src, srcOffset, dest, destOffset) {
@ -364,12 +364,9 @@ class PDFFunction {
throw new FormatError("Bad domain for stiched function");
}
const fnRefs = dict.get("Functions");
const fns = [];
for (let i = 0, ii = fnRefs.length; i < ii; ++i) {
fns.push(
this.parse({ xref, isEvalSupported, fn: xref.fetchIfRef(fnRefs[i]) })
);
for (const fn of dict.get("Functions")) {
fns.push(this.parse({ xref, isEvalSupported, fn: xref.fetchIfRef(fn) }));
}
const bounds = toNumberArray(dict.getArray("Bounds"));