From 0e5348180efcb140c49aa131a3072574664b9364 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sat, 16 Oct 2021 12:28:48 +0200 Subject: [PATCH] Fix the inconsistent return type of the `PDFDocument.isPureXfa` getter Also (slightly) simplifies a couple of small getters/methods related to the `XFAFactory`-instance. --- src/core/document.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/core/document.js b/src/core/document.js index 21373afc2..ab0d12cb2 100644 --- a/src/core/document.js +++ b/src/core/document.js @@ -900,14 +900,11 @@ class PDFDocument { } get isPureXfa() { - return this.xfaFactory && this.xfaFactory.isValid(); + return this.xfaFactory ? this.xfaFactory.isValid() : false; } get htmlForXfa() { - if (this.xfaFactory) { - return this.xfaFactory.getPages(); - } - return null; + return this.xfaFactory ? this.xfaFactory.getPages() : null; } async loadXfaImages() { @@ -1088,10 +1085,9 @@ class PDFDocument { } async serializeXfaData(annotationStorage) { - if (this.xfaFactory) { - return this.xfaFactory.serializeData(annotationStorage); - } - return null; + return this.xfaFactory + ? this.xfaFactory.serializeData(annotationStorage) + : null; } get formInfo() {