From 68d6c7cb8f09c96af539c60e756a6abfb6607407 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sun, 25 Oct 2020 14:17:28 +0100 Subject: [PATCH] Add (some) optional chaining usage in `src/display/api.js` Since we no longer use SystemJS to load the unit-tests, there's now nothing that prevents us from using optional chaining and nullish coalescing in the `src/display/` directory. --- src/display/api.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/display/api.js b/src/display/api.js index 6cc2daa5f88b81..ff7a6aaa320518 100644 --- a/src/display/api.js +++ b/src/display/api.js @@ -1168,8 +1168,7 @@ class PDFPageProxy { pageIndex: this._pageIndex, intent: renderingIntent, renderInteractiveForms: renderInteractiveForms === true, - annotationStorage: - (annotationStorage && annotationStorage.getAll()) || null, + annotationStorage: annotationStorage?.getAll() || null, }); } @@ -2551,8 +2550,7 @@ class WorkerTransport { return this.messageHandler .sendWithPromise("SaveDocument", { numPages: this._numPages, - annotationStorage: - (annotationStorage && annotationStorage.getAll()) || null, + annotationStorage: annotationStorage?.getAll() || null, filename: this._fullReader ? this._fullReader.filename : null, }) .finally(() => {