to-length.js 297 B

123456789
  1. var toInteger = require('../internals/to-integer');
  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(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
  7. };