mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 17:30:09 +02:00
Replace value === (value | 0)
checks with Number.isInteger(value)
in the web/
folder
Rather than doing what (at first) may seem like a fairly obscure comparison, using `Number.isInteger` will clearly indicate the intent of the code.
This commit is contained in:
parent
8686baede5
commit
30b7a0f093
3 changed files with 5 additions and 6 deletions
|
@ -98,7 +98,7 @@ class PDFLinkService {
|
|||
});
|
||||
return;
|
||||
}
|
||||
} else if ((destRef | 0) === destRef) { // Integer
|
||||
} else if (Number.isInteger(destRef)) {
|
||||
pageNumber = destRef + 1;
|
||||
} else {
|
||||
console.error(`PDFLinkService.navigateTo: "${destRef}" is not ` +
|
||||
|
@ -359,9 +359,8 @@ function isValidExplicitDestination(dest) {
|
|||
}
|
||||
let page = dest[0];
|
||||
if (!(typeof page === 'object' &&
|
||||
typeof page.num === 'number' && (page.num | 0) === page.num &&
|
||||
typeof page.gen === 'number' && (page.gen | 0) === page.gen) &&
|
||||
!(typeof page === 'number' && (page | 0) === page && page >= 0)) {
|
||||
Number.isInteger(page.num) && Number.isInteger(page.gen)) &&
|
||||
!(Number.isInteger(page) && page >= 0)) {
|
||||
return false;
|
||||
}
|
||||
let zoom = dest[1];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue