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

Function computeMovableDestIndex

src/js/components/Controller/Controller.ts:268–278  ·  view source on GitHub ↗

* Finds the dest index whose position is different with the current one for `trimSpace: 'move'`. * This can be negative or greater than `length - 1`. * * @param dest - A dest index. * * @return A dest index.

( dest: number )

Source from the content-addressed store, hash-verified

266 * @return A dest index.
267 */
268 function computeMovableDestIndex( dest: number ): number {
269 if ( isSlide && options.trimSpace === 'move' && dest !== currIndex ) {
270 const position = getPosition();
271
272 while ( position === toPosition( dest, true ) && between( dest, 0, Splide.length - 1, ! options.rewind ) ) {
273 dest < currIndex ? --dest : ++dest;
274 }
275 }
276
277 return dest;
278 }
279
280 /**
281 * Loops the provided index only in the loop mode.

Callers 1

computeDestIndexFunction · 0.85

Calls 3

betweenFunction · 0.90
getPositionFunction · 0.85
toPositionFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…