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

Update Prettier to version 2.0

Please note that these changes were done automatically, using `gulp lint --fix`.

Given that the major version number was increased, there's a fair number of (primarily whitespace) changes; please see https://prettier.io/blog/2020/03/21/2.0.0.html
In order to reduce the size of these changes somewhat, this patch maintains the old "arrowParens" style for now (once mozilla-central updates Prettier we can simply choose the same formatting, assuming it will differ here).
This commit is contained in:
Jonas Jenwald 2020-04-14 12:28:14 +02:00
parent a4dd081d7b
commit 426945b480
145 changed files with 2005 additions and 2009 deletions

View file

@ -271,7 +271,7 @@ class Catalog {
dests[name] = fetchDestination(names[name]);
}
} else if (obj instanceof Dict) {
obj.forEach(function(key, value) {
obj.forEach(function (key, value) {
if (value) {
dests[key] = fetchDestination(value);
}
@ -693,7 +693,7 @@ class Catalog {
fontFallback(id, handler) {
const promises = [];
this.fontCache.forEach(function(promise) {
this.fontCache.forEach(function (promise) {
promises.push(promise);
});
@ -712,7 +712,7 @@ class Catalog {
this.pageKidsCountCache.clear();
const promises = [];
this.fontCache.forEach(function(promise) {
this.fontCache.forEach(function (promise) {
promises.push(promise);
});
@ -754,7 +754,7 @@ class Catalog {
}
visitedNodes.put(currentNode);
xref.fetchAsync(currentNode).then(function(obj) {
xref.fetchAsync(currentNode).then(function (obj) {
if (isDict(obj, "Page") || (isDict(obj) && !obj.has("Kids"))) {
if (pageIndex === currentPageIndex) {
// Cache the Page reference, since it can *greatly* improve
@ -849,7 +849,7 @@ class Catalog {
return xref
.fetchAsync(kidRef)
.then(function(node) {
.then(function (node) {
if (
isRefsEqual(kidRef, pageRef) &&
!isDict(node, "Page") &&
@ -868,7 +868,7 @@ class Catalog {
parentRef = node.getRaw("Parent");
return node.getAsync("Parent");
})
.then(function(parent) {
.then(function (parent) {
if (!parent) {
return null;
}
@ -877,7 +877,7 @@ class Catalog {
}
return parent.getAsync("Kids");
})
.then(function(kids) {
.then(function (kids) {
if (!kids) {
return null;
}
@ -894,7 +894,7 @@ class Catalog {
break;
}
kidPromises.push(
xref.fetchAsync(kid).then(function(obj) {
xref.fetchAsync(kid).then(function (obj) {
if (!isDict(obj)) {
throw new FormatError("Kid node must be a dictionary.");
}
@ -910,7 +910,7 @@ class Catalog {
if (!found) {
throw new FormatError("Kid reference not found in parent's kids.");
}
return Promise.all(kidPromises).then(function() {
return Promise.all(kidPromises).then(function () {
return [total, parentRef];
});
});
@ -918,7 +918,7 @@ class Catalog {
let total = 0;
function next(ref) {
return pagesBeforeRef(ref).then(function(args) {
return pagesBeforeRef(ref).then(function (args) {
if (!args) {
return total;
}
@ -1069,9 +1069,7 @@ class Catalog {
const URL_OPEN_METHODS = ["app.launchURL", "window.open"];
const regex = new RegExp(
"^\\s*(" +
URL_OPEN_METHODS.join("|")
.split(".")
.join("\\.") +
URL_OPEN_METHODS.join("|").split(".").join("\\.") +
")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))",
"i"
);
@ -2186,7 +2184,7 @@ var FileSpec = (function FileSpecClosure() {
* that have references to the catalog or other pages since that will cause the
* entire PDF document object graph to be traversed.
*/
const ObjectLoader = (function() {
const ObjectLoader = (function () {
function mayHaveChildren(value) {
return (
value instanceof Ref ||