Reduce duplication in the PDFDocument.calculationOrderIds getter
This commit is contained in:
parent
e3b5ed2e40
commit
662bd022ce
@ -1947,12 +1947,7 @@ class PDFDocument {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get calculationOrderIds() {
|
get calculationOrderIds() {
|
||||||
const acroForm = this.catalog.acroForm;
|
const calculationOrder = this.catalog.acroForm?.get("CO");
|
||||||
if (!acroForm?.has("CO")) {
|
|
||||||
return shadow(this, "calculationOrderIds", null);
|
|
||||||
}
|
|
||||||
|
|
||||||
const calculationOrder = acroForm.get("CO");
|
|
||||||
if (!Array.isArray(calculationOrder) || calculationOrder.length === 0) {
|
if (!Array.isArray(calculationOrder) || calculationOrder.length === 0) {
|
||||||
return shadow(this, "calculationOrderIds", null);
|
return shadow(this, "calculationOrderIds", null);
|
||||||
}
|
}
|
||||||
@ -1963,10 +1958,7 @@ class PDFDocument {
|
|||||||
ids.push(id.toString());
|
ids.push(id.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ids.length === 0) {
|
return shadow(this, "calculationOrderIds", ids.length ? ids : null);
|
||||||
return shadow(this, "calculationOrderIds", null);
|
|
||||||
}
|
|
||||||
return shadow(this, "calculationOrderIds", ids);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get annotationGlobals() {
|
get annotationGlobals() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user