code: function resolveIntIdx(inputInt, maxLen, checkBounds) {
    if (isUndefined(checkBounds)) {
      checkBounds = true;
    }
    if (!Number.isInteger(inputInt)) {
      throw new Error('expected integer selector for integer indexing ' +
        'but got non-integer: ' + inputInt);
    }
    var result = inputInt < 0 ? maxLen + inputInt : inputInt;
    if (checkBounds && (result < 0 || result >= maxLen)) {
      throw new Error('integer index out of bounds');
    }
    return result;
  }
docs: Uses 'maxLen' to compute the integer index for 'inputInt' or throws an error if invalid.  'checkBounds' is true by default but if false, the resulting integer index won't be checked.