es.number.is-safe-integer.js 383 B

123456789101112
  1. var $ = require('../internals/export');
  2. var isIntegralNumber = require('../internals/is-integral-number');
  3. var abs = Math.abs;
  4. // `Number.isSafeInteger` method
  5. // https://tc39.es/ecma262/#sec-number.issafeinteger
  6. $({ target: 'Number', stat: true }, {
  7. isSafeInteger: function isSafeInteger(number) {
  8. return isIntegralNumber(number) && abs(number) <= 0x1FFFFFFFFFFFFF;
  9. }
  10. });