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