function normalizeIndex(arrayLength, idx) {
  if (idx < 0) {
    idx = arrayLength + idx
  }
  return idx < 0 || idx >= arrayLength ? null : idx
}
Ensures the given index is a valid index inside the array.

A negative index value is converted to a positive one by adding it to the
array length before checking it.

@memberof Shim.prototype
@param {number} arrayLength  - The length of the array this index is for.
@param {number} idx          - The index to normalize.
@returns {?number} The adjusted index value if it is valid, else `null`.