UNPKG

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