public/javascripts/yui/carousel/carousel-debug.js
function (index) {
            var carousel   = this,
                isCircular = carousel.get("isCircular"),
                numItems   = carousel.get("numItems"),
                numVisible = carousel.get("numVisible"),
                sentinel   = numItems - 1;

            if (index < 0) {
                index = isCircular ?
                        Math.ceil(numItems/numVisible)*numVisible + index : 0;
            } else if (index > sentinel) {
                index = isCircular ? 0 : sentinel;
            }

            return index;
        }
function (index) {
            var carousel   = this,
                isCircular = carousel.get("isCircular"),
                numItems   = carousel.get("numItems"),
                numVisible = carousel.get("numVisible"),
                sentinel   = numItems - 1;

            if (index < 0) {
                index = isCircular ?
                        Math.ceil(numItems/numVisible)*numVisible + index : 0;
            } else if (index > sentinel) {
                index = isCircular ? 0 : sentinel;
            }

            return index;
        }
function ( index ) { var carousel = this , isCircular = carousel . get ( "isCircular" ) , numItems = carousel . get ( "numItems" ) , numVisible = carousel . get ( "numVisible" ) , sentinel = numItems - 1 ; if ( index < 0 ) { index = isCircular ? Math . ceil ( numItems / numVisible ) * numVisible + index : 0 ; } else if ( index > sentinel ) { index = isCircular ? 0 : sentinel ; } return index ; }
Return a valid item for a possibly out of bounds index considering
the isCircular property.

@method _getValidIndex
@param index {Number} The index of the item to be returned
@return {Object} Return a valid item index
@protected
Return a valid item for a possibly out of bounds index considering the isCircular property .