MCPcopy
hub / github.com/formatjs/formatjs / shouldPolyfill

Function shouldPolyfill

packages/intl-pluralrules/should-polyfill.ts:12–22  ·  view source on GitHub ↗
(locale = 'en')

Source from the content-addressed store, hash-verified

10}
11
12export function shouldPolyfill(locale = 'en'): string | undefined {
13 if (
14 typeof Intl === 'undefined' ||
15 !('PluralRules' in Intl) ||
16 new Intl.PluralRules('en', {minimumFractionDigits: 2} as any).select(1) ===
17 'one' ||
18 !supportedLocalesOf(locale)
19 ) {
20 return locale ? match([locale], supportedLocales, 'en') : undefined
21 }
22}

Callers 1

polyfill.tsFile · 0.70

Calls 3

matchFunction · 0.90
selectMethod · 0.80
supportedLocalesOfFunction · 0.70

Tested by

no test coverage detected