Use optional chaining, where possible, in the web/-folder

By using optional chaining, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining, it's possible to reduce unnecessary code-repetition in many cases.
This commit is contained in:
Jonas Jenwald 2021-02-05 17:36:28 +01:00
parent dc19965d78
commit 063a072742
11 changed files with 27 additions and 32 deletions

View file

@ -445,7 +445,7 @@ class PDFLinkService {
_cachedPageNumber(pageRef) {
const refStr =
pageRef.gen === 0 ? `${pageRef.num}R` : `${pageRef.num}R${pageRef.gen}`;
return (this._pagesRefCache && this._pagesRefCache[refStr]) || null;
return this._pagesRefCache?.[refStr] || null;
}
/**