aswi2020vldc-gitlab/templetes/node_modules/es-abstract/2019/ToLength.js @ 56f6c6df
1 |
'use strict'; |
---|---|
2 |
|
3 |
var MAX_SAFE_INTEGER = require('../helpers/maxSafeInteger'); |
4 |
|
5 |
var ToInteger = require('./ToInteger'); |
6 |
|
7 |
module.exports = function ToLength(argument) { |
8 |
var len = ToInteger(argument); |
9 |
if (len <= 0) { return 0; } // includes converting -0 to +0 |
10 |
if (len > MAX_SAFE_INTEGER) { return MAX_SAFE_INTEGER; } |
11 |
return len; |
12 |
};
|