1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 01:58:06 +02:00

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

Note that these cases, which are all in older code, were found using the [`unicorn/no-for-loop`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-for-loop.md) ESLint plugin rule.
However, note that I've opted not to enable this rule by default since there's still *some* cases where I do think that it makes sense to allow "regular" for-loops.
This commit is contained in:
Jonas Jenwald 2022-07-17 15:48:39 +02:00
parent 5bfba89b0a
commit 37ebc28756
14 changed files with 35 additions and 50 deletions

View file

@ -196,13 +196,13 @@ exports.optimizeCMap = function (data) {
i++;
data.body.splice(i, 0, newItem);
}
for (let j = 0; j < subitems.length; j++) {
const code = subitems[j].code;
for (const subitem of subitems) {
const { code } = subitem;
let q = 0;
while (q < groups.length && groups[q] <= code) {
q++;
}
buckets[q].push(subitems[j]);
buckets[q].push(subitem);
}
}
}