main
Last change
on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
475 bytes
|
Rev | Line | |
---|
[79a0317] | 1 | 'use strict';
|
---|
| 2 | var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');
|
---|
| 3 | var toLength = require('../internals/to-length');
|
---|
| 4 |
|
---|
| 5 | var $RangeError = RangeError;
|
---|
| 6 |
|
---|
| 7 | // `ToIndex` abstract operation
|
---|
| 8 | // https://tc39.es/ecma262/#sec-toindex
|
---|
| 9 | module.exports = function (it) {
|
---|
| 10 | if (it === undefined) return 0;
|
---|
| 11 | var number = toIntegerOrInfinity(it);
|
---|
| 12 | var length = toLength(number);
|
---|
| 13 | if (number !== length) throw new $RangeError('Wrong length or index');
|
---|
| 14 | return length;
|
---|
| 15 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.