Node-Red configuration
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.

to-index.js 475B

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