mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-25 09:38:06 +02:00
Replace value === (value | 0)
checks with Number.isInteger(value)
in the src/
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
c8b5ba277a
commit
8686baede5
4 changed files with 8 additions and 7 deletions
|
@ -1032,7 +1032,7 @@ var PostScriptCompiler = (function PostScriptCompilerClosure() {
|
|||
return null;
|
||||
}
|
||||
n = num1.number;
|
||||
if (n < 0 || (n | 0) !== n || stack.length < n) {
|
||||
if (n < 0 || !Number.isInteger(n) || stack.length < n) {
|
||||
return null;
|
||||
}
|
||||
ast1 = stack[stack.length - n - 1];
|
||||
|
@ -1082,7 +1082,8 @@ var PostScriptCompiler = (function PostScriptCompilerClosure() {
|
|||
}
|
||||
j = num2.number;
|
||||
n = num1.number;
|
||||
if (n <= 0 || (n | 0) !== n || (j | 0) !== j || stack.length < n) {
|
||||
if (n <= 0 || !Number.isInteger(n) || !Number.isInteger(j) ||
|
||||
stack.length < n) {
|
||||
// ... and integers
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue