* 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'] )
| 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. |
no outgoing calls
no test coverage detected
searching dependent graphs…