code: function normalizeIndex({ items, itemsPerSlide }, index) {
      let result = index;
      result %= items.length || 1; // Ensure index is within bounds.
      result -= result % (itemsPerSlide || 1); // Round index to the nearest valid slide index.
      result = Math.abs(result); // Ensure positive value.
      return result;
  }
docs: Ensures that an index is valid.
  
  @param {object} state The widget state.
  @param {number} index the index to normalize.