2020-08-25 23:57:08 +00:00
|
|
|
'use strict';
|
|
|
|
|
2021-02-26 03:58:33 +00:00
|
|
|
var abs = require('./abs');
|
|
|
|
var floor = require('./floor');
|
2020-08-25 23:57:08 +00:00
|
|
|
|
|
|
|
var $isNaN = require('../helpers/isNaN');
|
|
|
|
var $isFinite = require('../helpers/isFinite');
|
|
|
|
|
2021-02-26 03:58:33 +00:00
|
|
|
// https://ecma-international.org/ecma-262/6.0/#sec-isinteger
|
2020-08-25 23:57:08 +00:00
|
|
|
|
|
|
|
module.exports = function IsInteger(argument) {
|
|
|
|
if (typeof argument !== 'number' || $isNaN(argument) || !$isFinite(argument)) {
|
|
|
|
return false;
|
|
|
|
}
|
2021-02-26 03:58:33 +00:00
|
|
|
var absValue = abs(argument);
|
|
|
|
return floor(absValue) === absValue;
|
2020-08-25 23:57:08 +00:00
|
|
|
};
|