mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 01:58:06 +02:00
Enable the dot-notation
ESLint rule
*Please note:* These changes were done automatically, using the `gulp lint --fix` command. This rule is already enabled in mozilla-central, see https://searchfox.org/mozilla-central/rev/567b68b8ff4b6d607ba34a6f1926873d21a7b4d7/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/recommended.js#103-104 The main advantage, besides improved consistency, of this rule is that it reduces the size of the code (by 3 bytes for each case). In the PDF.js code-base there's close to 8000 instances being fixed by the `dot-notation` ESLint rule, which end up reducing the size of even the *built* files significantly; the total size of the `gulp mozcentral` build target changes from `3 247 456` to `3 224 278` bytes, which is a *reduction* of `23 178` bytes (or ~0.7%) for a completely mechanical change. A large number of these changes affect the (large) lookup tables used on the worker-thread, but given that they are still initialized lazily I don't *think* that the new formatting this patch introduces should undo any of the improvements from PR 6915. Please find additional details about the ESLint rule at https://eslint.org/docs/rules/dot-notation
This commit is contained in:
parent
c218e94f66
commit
1cc3dbb694
26 changed files with 7773 additions and 7785 deletions
|
@ -1188,13 +1188,13 @@ var JpxImage = (function JpxImageClosure() {
|
|||
var codeblockIncluded = false;
|
||||
var firstTimeInclusion = false;
|
||||
var valueReady;
|
||||
if (codeblock["included"] !== undefined) {
|
||||
if (codeblock.included !== undefined) {
|
||||
codeblockIncluded = !!readBits(1);
|
||||
} else {
|
||||
// reading inclusion tree
|
||||
precinct = codeblock.precinct;
|
||||
var inclusionTree, zeroBitPlanesTree;
|
||||
if (precinct["inclusionTree"] !== undefined) {
|
||||
if (precinct.inclusionTree !== undefined) {
|
||||
inclusionTree = precinct.inclusionTree;
|
||||
} else {
|
||||
// building inclusion and zero bit-planes trees
|
||||
|
@ -1264,7 +1264,7 @@ var JpxImage = (function JpxImageClosure() {
|
|||
while (queue.length > 0) {
|
||||
var packetItem = queue.shift();
|
||||
codeblock = packetItem.codeblock;
|
||||
if (codeblock["data"] === undefined) {
|
||||
if (codeblock.data === undefined) {
|
||||
codeblock.data = [];
|
||||
}
|
||||
codeblock.data.push({
|
||||
|
@ -1302,7 +1302,7 @@ var JpxImage = (function JpxImageClosure() {
|
|||
if (blockWidth === 0 || blockHeight === 0) {
|
||||
continue;
|
||||
}
|
||||
if (codeblock["data"] === undefined) {
|
||||
if (codeblock.data === undefined) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue