src/components/ebay-carousel/index.js
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;
}
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;
}
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 ; }
Ensures that an index is valid.

@param {object} state The widget state.
@param {number} index the index to normalize.
Ensures that an index is valid .