Skip to content

Commit f3fcb74

Browse files
committed
Reverting to previous approach due to 32-bit nature of bitwise operators. In addition, Infinity will not pass as an integer
1 parent 7798f16 commit f3fcb74

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

functions/var/is_int.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ function is_int (mixed_var) {
1616
// * returns 3: false
1717
// * example 4: is_int(true)
1818
// * returns 4: false
19-
return mixed_var === ~~mixed_var;
19+
20+
return mixed_var === +mixed_var && isFinite(mixed_var) && !(mixed_var % 1);
2021
}

0 commit comments

Comments
 (0)