|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
427 bytes
|
| Line | |
|---|
| 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|---|
| 4 |
|
|---|
| 5 | const MAX_ARRAY_LENGTH = require('../_internal/MAX_ARRAY_LENGTH.js');
|
|---|
| 6 | const clamp = require('../math/clamp.js');
|
|---|
| 7 |
|
|---|
| 8 | function toLength(value) {
|
|---|
| 9 | if (value == null) {
|
|---|
| 10 | return 0;
|
|---|
| 11 | }
|
|---|
| 12 | const length = Math.floor(Number(value));
|
|---|
| 13 | return clamp.clamp(length, 0, MAX_ARRAY_LENGTH.MAX_ARRAY_LENGTH);
|
|---|
| 14 | }
|
|---|
| 15 |
|
|---|
| 16 | exports.toLength = toLength;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.