does-not-exceed-safe-integer.js 249 B

12345678
  1. 'use strict';
  2. var $TypeError = TypeError;
  3. var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; // 2 ** 53 - 1 == 9007199254740991
  4. module.exports = function (it) {
  5. if (it > MAX_SAFE_INTEGER) throw $TypeError('Maximum allowed index exceeded');
  6. return it;
  7. };