mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 10:08:06 +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
|
@ -784,11 +784,10 @@ class Annotation {
|
|||
* @param {Array} rectangle - The rectangle array with exactly four entries
|
||||
*/
|
||||
setRectangle(rectangle) {
|
||||
if (Array.isArray(rectangle) && rectangle.length === 4) {
|
||||
this.rectangle = Util.normalizeRect(rectangle);
|
||||
} else {
|
||||
this.rectangle = [0, 0, 0, 0];
|
||||
}
|
||||
this.rectangle =
|
||||
Array.isArray(rectangle) && rectangle.length === 4
|
||||
? Util.normalizeRect(rectangle)
|
||||
: [0, 0, 0, 0];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -841,11 +840,7 @@ class Annotation {
|
|||
setRotation(mk, dict) {
|
||||
this.rotation = 0;
|
||||
let angle;
|
||||
if (mk instanceof Dict) {
|
||||
angle = mk.get("R") || 0;
|
||||
} else {
|
||||
angle = dict.get("Rotate") || 0;
|
||||
}
|
||||
angle = mk instanceof Dict ? mk.get("R") || 0 : dict.get("Rotate") || 0;
|
||||
if (Number.isInteger(angle) && angle !== 0) {
|
||||
angle %= 360;
|
||||
if (angle < 0) {
|
||||
|
@ -2815,11 +2810,9 @@ class ButtonWidgetAnnotation extends WidgetAnnotation {
|
|||
if (value === null || value === undefined) {
|
||||
// There is no default appearance so use the one derived
|
||||
// from the field value.
|
||||
if (this.data.checkBox) {
|
||||
value = this.data.fieldValue === this.data.exportValue;
|
||||
} else {
|
||||
value = this.data.fieldValue === this.data.buttonValue;
|
||||
}
|
||||
value = this.data.checkBox
|
||||
? this.data.fieldValue === this.data.exportValue
|
||||
: this.data.fieldValue === this.data.buttonValue;
|
||||
}
|
||||
|
||||
const appearance = value
|
||||
|
@ -3610,11 +3603,10 @@ class PopupAnnotation extends Annotation {
|
|||
}
|
||||
|
||||
const parentRect = parentItem.getArray("Rect");
|
||||
if (Array.isArray(parentRect) && parentRect.length === 4) {
|
||||
this.data.parentRect = Util.normalizeRect(parentRect);
|
||||
} else {
|
||||
this.data.parentRect = null;
|
||||
}
|
||||
this.data.parentRect =
|
||||
Array.isArray(parentRect) && parentRect.length === 4
|
||||
? Util.normalizeRect(parentRect)
|
||||
: null;
|
||||
|
||||
const rt = parentItem.get("RT");
|
||||
if (isName(rt, AnnotationReplyType.GROUP)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue