diff --git a/util.js b/util.js index 8a05b06..d65b5a0 100644 --- a/util.js +++ b/util.js @@ -3,7 +3,7 @@ var t = require('tcomb'); function isInteger(n) { - return n % 1 === 0; + return typeof n === 'number' && isFinite(n) && Math.floor(n) === n; } var Null = t.irreducible('Null', function (x) { return x === null; }); @@ -13,4 +13,4 @@ module.exports = { isInteger: isInteger, Null: Null, Int: Int -}; \ No newline at end of file +};