Last change
on this file since e29cc2e was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
393 bytes
|
Line | |
---|
1 | var toInteger = require('../internals/to-integer');
|
---|
2 | var toLength = require('../internals/to-length');
|
---|
3 |
|
---|
4 | // `ToIndex` abstract operation
|
---|
5 | // https://tc39.es/ecma262/#sec-toindex
|
---|
6 | module.exports = function (it) {
|
---|
7 | if (it === undefined) return 0;
|
---|
8 | var number = toInteger(it);
|
---|
9 | var length = toLength(number);
|
---|
10 | if (number !== length) throw RangeError('Wrong length or index');
|
---|
11 | return length;
|
---|
12 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.