mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 17:30:09 +02:00
Enable the unicorn/prefer-ternary
ESLint plugin rule
To limit the readability impact of these changes, the `only-single-line` option was used; please find additional details at https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-ternary.md These changes were done automatically, using the `gulp lint --fix` command.
This commit is contained in:
parent
8f83a1359e
commit
674e7ee381
31 changed files with 123 additions and 265 deletions
|
@ -463,11 +463,10 @@ class PartialEvaluator {
|
|||
const dict = xobj.dict;
|
||||
const matrix = dict.getArray("Matrix");
|
||||
let bbox = dict.getArray("BBox");
|
||||
if (Array.isArray(bbox) && bbox.length === 4) {
|
||||
bbox = Util.normalizeRect(bbox);
|
||||
} else {
|
||||
bbox = null;
|
||||
}
|
||||
bbox =
|
||||
Array.isArray(bbox) && bbox.length === 4
|
||||
? Util.normalizeRect(bbox)
|
||||
: null;
|
||||
|
||||
let optionalContent, groupOptions;
|
||||
if (dict.has("OC")) {
|
||||
|
@ -795,11 +794,9 @@ class PartialEvaluator {
|
|||
|
||||
if (cacheKey && imageRef && cacheGlobally) {
|
||||
let length = 0;
|
||||
if (imgData.bitmap) {
|
||||
length = imgData.width * imgData.height * 4;
|
||||
} else {
|
||||
length = imgData.data.length;
|
||||
}
|
||||
length = imgData.bitmap
|
||||
? imgData.width * imgData.height * 4
|
||||
: imgData.data.length;
|
||||
this.globalImageCache.addByteSize(imageRef, length);
|
||||
}
|
||||
|
||||
|
@ -3953,11 +3950,7 @@ class PartialEvaluator {
|
|||
if (!(lookupName in Metrics)) {
|
||||
// Use default fonts for looking up font metrics if the passed
|
||||
// font is not a base font
|
||||
if (this.isSerifFont(name)) {
|
||||
lookupName = "Times-Roman";
|
||||
} else {
|
||||
lookupName = "Helvetica";
|
||||
}
|
||||
lookupName = this.isSerifFont(name) ? "Times-Roman" : "Helvetica";
|
||||
}
|
||||
const glyphWidths = Metrics[lookupName];
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue