to-length.js 329 B

123456789
  1. var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');
  2. var min = Math.min;
  3. // `ToLength` abstract operation
  4. // https://tc39.es/ecma262/#sec-tolength
  5. module.exports = function (argument) {
  6. return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
  7. };