hexo/node_modules/es-abstract/2020/IsInteger.js

18 lines
462 B
JavaScript
Raw Normal View History

2023-10-03 11:14:36 +08:00
'use strict';
var abs = require('./abs');
var floor = require('./floor');
var $isNaN = require('../helpers/isNaN');
var $isFinite = require('../helpers/isFinite');
// https://262.ecma-international.org/6.0/#sec-isinteger
module.exports = function IsInteger(argument) {
if (typeof argument !== 'number' || $isNaN(argument) || !$isFinite(argument)) {
return false;
}
var absValue = abs(argument);
return floor(absValue) === absValue;
};