IsIntegralNumber.js 377 B

123456789101112131415
  1. 'use strict';
  2. var truncate = require('./truncate');
  3. var Type = require('./Type');
  4. var $isFinite = require('../helpers/isFinite');
  5. // https://262.ecma-international.org/14.0/#sec-isintegralnumber
  6. module.exports = function IsIntegralNumber(argument) {
  7. if (Type(argument) !== 'Number' || !$isFinite(argument)) {
  8. return false;
  9. }
  10. return truncate(argument) === argument;
  11. };