mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-25 09:38:06 +02:00
Introduce more optional chaining in the src/core/
folder
After PR 12563 we're now free to use optional chaining in the worker-thread as well. (This patch also fixes one previously "missed" case in the `web/` folder.) For the MOZCENTRAL build-target this patch reduces the total bundle-size by `1.6` kilobytes.
This commit is contained in:
parent
c20c1b3362
commit
1b4a7c5965
27 changed files with 90 additions and 137 deletions
|
@ -1251,7 +1251,7 @@ class Lexer {
|
|||
}
|
||||
}
|
||||
const knownCommands = this.knownCommands;
|
||||
let knownCommandFound = knownCommands && knownCommands[str] !== undefined;
|
||||
let knownCommandFound = knownCommands?.[str] !== undefined;
|
||||
while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
|
||||
// Stop if a known command is found and next character does not make
|
||||
// the string a command.
|
||||
|
@ -1263,7 +1263,7 @@ class Lexer {
|
|||
throw new FormatError(`Command token too long: ${str.length}`);
|
||||
}
|
||||
str = possibleCommand;
|
||||
knownCommandFound = knownCommands && knownCommands[str] !== undefined;
|
||||
knownCommandFound = knownCommands?.[str] !== undefined;
|
||||
}
|
||||
if (str === "true") {
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue