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

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