MCPcopy
hub / github.com/Splidejs/splide / loop

Function loop

src/js/components/Move/Move.ts:135–147  ·  view source on GitHub ↗

* Loops the provided position if it exceeds bounds (limit indices). * * @param position - A position to loop.

( position: number )

Source from the content-addressed store, hash-verified

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.

Callers 1

translateFunction · 0.70

Calls 4

shiftFunction · 0.85
getEndMethod · 0.80
toIndexFunction · 0.70
isMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…