1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Reduce duplication in the PDFDocument.calculationOrderIds getter

This commit is contained in:
Jonas Jenwald 2024-10-08 12:24:09 +02:00
parent e3b5ed2e40
commit 662bd022ce

View file

@ -1947,12 +1947,7 @@ class PDFDocument {
}
get calculationOrderIds() {
const acroForm = this.catalog.acroForm;
if (!acroForm?.has("CO")) {
return shadow(this, "calculationOrderIds", null);
}
const calculationOrder = acroForm.get("CO");
const calculationOrder = this.catalog.acroForm?.get("CO");
if (!Array.isArray(calculationOrder) || calculationOrder.length === 0) {
return shadow(this, "calculationOrderIds", null);
}
@ -1963,10 +1958,7 @@ class PDFDocument {
ids.push(id.toString());
}
}
if (ids.length === 0) {
return shadow(this, "calculationOrderIds", null);
}
return shadow(this, "calculationOrderIds", ids);
return shadow(this, "calculationOrderIds", ids.length ? ids : null);
}
get annotationGlobals() {