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

Function resolve

src/js/components/Direction/Direction.ts:52–61  ·  view source on GitHub ↗

* Resolves the provided property name. * * @param prop - A property name to translate. * @param axisOnly - Optional. If `ture`, returns the same property for LTR and RTL. * @param direction - Optional. Specify the direction. The default value is the `direction` option.

( prop: string, axisOnly?: boolean, direction?: Options['direction'] )

Source from the content-addressed store, hash-verified

50 * @param direction - Optional. Specify the direction. The default value is the `direction` option.
51 */
52 function resolve( prop: string, axisOnly?: boolean, direction?: Options['direction'] ): string {
53 direction = direction || options.direction;
54 const index = direction === RTL && ! axisOnly ? 1 : direction === TTB ? 0 : -1;
55
56 return ORIENTATION_MAP[ prop ] && ORIENTATION_MAP[ prop ][ index ]
57 || prop.replace( /width|left|right/i, ( match, offset ) => {
58 const replacement = ORIENTATION_MAP[ match.toLowerCase() ][ index ] || match;
59 return offset > 0 ? replacement.charAt( 0 ).toUpperCase() + replacement.slice( 1 ) : replacement;
60 } );
61 }
62
63 /**
64 * Orients the value towards the current direction.

Callers 15

onKeydownFunction · 0.85
translateFunction · 0.85
getPositionFunction · 0.85
canShiftFunction · 0.85
initFunction · 0.85
resizeFunction · 0.85
cssPaddingFunction · 0.85
listSizeFunction · 0.85
slideSizeFunction · 0.85
totalSizeFunction · 0.85
getGapFunction · 0.85
getPaddingFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…