mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-25 09:38:06 +02:00
Replace a bunch of Array.prototype.forEach()
cases with for...of
loops instead
Using `for...of` is a modern and generally much nicer pattern, since it gets rid of unnecessary callback-functions. (In a couple of spots, a "regular" `for` loop had to be used.)
This commit is contained in:
parent
da0e7ea969
commit
da22146b95
14 changed files with 67 additions and 71 deletions
|
@ -1337,13 +1337,14 @@ var PostScriptCompiler = (function PostScriptCompilerClosure() {
|
|||
}
|
||||
|
||||
var result = [];
|
||||
instructions.forEach(function (instruction) {
|
||||
var statementBuilder = new ExpressionBuilderVisitor();
|
||||
for (const instruction of instructions) {
|
||||
const statementBuilder = new ExpressionBuilderVisitor();
|
||||
instruction.visit(statementBuilder);
|
||||
result.push(statementBuilder.toString());
|
||||
});
|
||||
stack.forEach(function (expr, i) {
|
||||
var statementBuilder = new ExpressionBuilderVisitor();
|
||||
}
|
||||
for (let i = 0, ii = stack.length; i < ii; i++) {
|
||||
const expr = stack[i],
|
||||
statementBuilder = new ExpressionBuilderVisitor();
|
||||
expr.visit(statementBuilder);
|
||||
var min = range[i * 2],
|
||||
max = range[i * 2 + 1];
|
||||
|
@ -1359,7 +1360,7 @@ var PostScriptCompiler = (function PostScriptCompilerClosure() {
|
|||
out.unshift("dest[destOffset + ", i, "] = ");
|
||||
out.push(";");
|
||||
result.push(out.join(""));
|
||||
});
|
||||
}
|
||||
return result.join("\n");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue