function validateIndex(index, length) {
  if (!_number__WEBPACK_IMPORTED_MODULE_0___default.a.isNumber(index) || !_number__WEBPACK_IMPORTED_MODULE_0___default.a.isInteger(index)) {
    throw new TypeError('Index must be an integer (value: ' + index + ')');
  }

  if (index < 0 || typeof length === 'number' && index >= length) {
    throw new _error_IndexError__WEBPACK_IMPORTED_MODULE_3___default.a(index, length);
  }
}
Test whether index is an integer number with index >= 0 and index < length
when length is provided
@param {number} index    Zero-based index
@param {number} [length] Length of the array