MCPcopy Create free account
hub / github.com/angular/components / _resolveDirectionality

Function _resolveDirectionality

src/cdk/bidi/directionality.ts:19–27  ·  view source on GitHub ↗
(rawValue: string)

Source from the content-addressed store, hash-verified

17
18/** Resolves a string value to a specific direction. */
19export function _resolveDirectionality(rawValue: string): Direction {
20 const value = rawValue?.toLowerCase() || '';
21
22 if (value === 'auto' && typeof navigator !== 'undefined' && navigator?.language) {
23 return RTL_LOCALE_PATTERN.test(navigator.language) ? 'rtl' : 'ltr';
24 }
25
26 return value === 'rtl' ? 'rtl' : 'ltr';
27}
28
29/**
30 * The directionality (LTR / RTL) context for the application (or a subtree of it).

Callers 2

dirMethod · 0.90
constructorMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected