_to-absolute-index.js 223 B

12345678
  1. var toInteger = require('./_to-integer');
  2. var max = Math.max;
  3. var min = Math.min;
  4. module.exports = function (index, length) {
  5. index = toInteger(index);
  6. return index < 0 ? max(index + length, 0) : min(index, length);
  7. };