|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 13 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
435 bytes
|
| Rev | Line | |
|---|
| [9af201e] | 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | var MAX_SAFE_INTEGER = require('math-intrinsics/constants/maxSafeInteger');
|
|---|
| 4 |
|
|---|
| 5 | var ToIntegerOrInfinity = require('./ToIntegerOrInfinity');
|
|---|
| 6 |
|
|---|
| 7 | // https://262.ecma-international.org/12.0/#sec-tolength
|
|---|
| 8 |
|
|---|
| 9 | module.exports = function ToLength(argument) {
|
|---|
| 10 | var len = ToIntegerOrInfinity(argument);
|
|---|
| 11 | if (len <= 0) { return 0; } // includes converting -0 to +0
|
|---|
| 12 | if (len > MAX_SAFE_INTEGER) { return MAX_SAFE_INTEGER; }
|
|---|
| 13 | return len;
|
|---|
| 14 | };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.