* Loops the provided position if it exceeds bounds (limit indices). * * @param position - A position to loop.
( position: number )
| 133 | * @param position - A position to loop. |
| 134 | */ |
| 135 | function loop( position: number ): number { |
| 136 | if ( Splide.is( LOOP ) ) { |
| 137 | const index = toIndex( position ); |
| 138 | const exceededMax = index > Components.Controller.getEnd(); |
| 139 | const exceededMin = index < 0; |
| 140 | |
| 141 | if ( exceededMin || exceededMax ) { |
| 142 | position = shift( position, exceededMax ); |
| 143 | } |
| 144 | } |
| 145 | |
| 146 | return position; |
| 147 | } |
| 148 | |
| 149 | /** |
| 150 | * Adds or subtracts the slider width to the provided position. |