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

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