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
439 B

  1. var toInteger = require('../internals/to-integer');
  2. var max = Math.max;
  3. var min = Math.min;
  4. // Helper for a popular repeating case of the spec:
  5. // Let integer be ? ToInteger(index).
  6. // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
  7. module.exports = function (index, length) {
  8. var integer = toInteger(index);
  9. return integer < 0 ? max(integer + length, 0) : min(integer, length);
  10. };