MCPcopy
hub / github.com/formatjs/formatjs / match

Function match

packages/intl-localematcher/index.ts:8–24  ·  view source on GitHub ↗
(
  requestedLocales: readonly string[],
  availableLocales: readonly string[],
  defaultLocale: string,
  opts?: Opts
)

Source from the content-addressed store, hash-verified

6}
7
8export function match(
9 requestedLocales: readonly string[],
10 availableLocales: readonly string[],
11 defaultLocale: string,
12 opts?: Opts
13): string {
14 return ResolveLocale(
15 availableLocales,
16 CanonicalizeLocaleList(requestedLocales),
17 {
18 localeMatcher: opts?.algorithm || 'best fit',
19 },
20 [],
21 {},
22 () => defaultLocale
23 ).locale
24}
25
26export {LookupSupportedLocales} from '#packages/intl-localematcher/abstract/LookupSupportedLocales.js'
27export {ResolveLocale} from '#packages/intl-localematcher/abstract/ResolveLocale.js'

Callers 9

shouldPolyfillFunction · 0.90
shouldPolyfillFunction · 0.90
shouldPolyfillFunction · 0.90
shouldPolyfillFunction · 0.90
shouldPolyfillFunction · 0.90
shouldPolyfillFunction · 0.90
matchLocaleFunction · 0.90
index.test.tsFile · 0.85

Calls 2

ResolveLocaleFunction · 0.85
CanonicalizeLocaleListFunction · 0.50

Tested by

no test coverage detected