massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / core-js / internals / to-index.js
1 var global = require('../internals/global');
2 var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');
3 var toLength = require('../internals/to-length');
4
5 var RangeError = global.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 RangeError('Wrong length or index');
14   return length;
15 };