web 3d图形渲染器
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12 lines
393 B

  1. var toInteger = require('../internals/to-integer');
  2. var toLength = require('../internals/to-length');
  3. // `ToIndex` abstract operation
  4. // https://tc39.es/ecma262/#sec-toindex
  5. module.exports = function (it) {
  6. if (it === undefined) return 0;
  7. var number = toInteger(it);
  8. var length = toLength(number);
  9. if (number !== length) throw RangeError('Wrong length or index');
  10. return length;
  11. };