@formatjs/intl-getcanonicallocales 3.3.0 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +1 -12
- package/index.js +104 -32
- package/index.js.map +1 -1
- package/package.json +6 -1
- package/polyfill-force.js +106 -36
- package/polyfill-force.js.map +1 -1
- package/polyfill.iife.js +115 -41
- package/polyfill.js +115 -41
- package/polyfill.js.map +1 -1
- package/should-polyfill.d.ts +1 -4
- package/should-polyfill.js +8 -3
- package/should-polyfill.js.map +1 -1
package/should-polyfill.d.ts
CHANGED
package/should-polyfill.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/intl-getcanonicallocales/should-polyfill.ts
|
|
2
2
|
function shouldPolyfill() {
|
|
3
|
-
|
|
3
|
+
if (typeof Intl === "undefined" || typeof Intl.getCanonicalLocales !== "function") return true;
|
|
4
|
+
try {
|
|
5
|
+
const canonicalize = Intl.getCanonicalLocales;
|
|
6
|
+
return canonicalize("und-x-private")[0] !== "und-x-private" || canonicalize("en-u-aa-yes")[0] !== "en-u-aa-yes" || canonicalize("en-u-kn-yes")[0] !== "en-u-kn";
|
|
7
|
+
} catch {
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
4
10
|
}
|
|
5
|
-
//#endregion
|
|
6
11
|
export { shouldPolyfill };
|
|
7
12
|
|
|
8
13
|
//# sourceMappingURL=should-polyfill.js.map
|
package/should-polyfill.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"should-polyfill.js","names":[],"sources":["sources/packages/intl-getcanonicallocales/should-polyfill.ts"],"sourcesContent":["export function shouldPolyfill(): boolean {\n
|
|
1
|
+
{"version":3,"file":"should-polyfill.js","names":[],"sources":["sources/packages/intl-getcanonicallocales/should-polyfill.ts"],"sourcesContent":["export function shouldPolyfill(): boolean {\n if (\n typeof Intl === 'undefined' ||\n typeof (Intl as any).getCanonicalLocales !== 'function'\n ) {\n return true\n }\n try {\n const canonicalize = (Intl as any).getCanonicalLocales\n return (\n // https://bugs.chromium.org/p/v8/issues/detail?id=10682\n canonicalize('und-x-private')[0] !== 'und-x-private' ||\n // ECMA-402 canonicalizes aliases by key; only whole \"true\" values disappear.\n // https://tc39.es/ecma402/#sec-canonicalizeunicodelocaleid\n canonicalize('en-u-aa-yes')[0] !== 'en-u-aa-yes' ||\n canonicalize('en-u-kn-yes')[0] !== 'en-u-kn'\n )\n } catch {\n return true\n }\n}\n"],"mappings":";AAAA,SAAgB,iBAA0B;CACxC,IACE,OAAO,SAAS,eAChB,OAAQ,KAAa,wBAAwB,YAE7C,OAAO;CAET,IAAI;EACF,MAAM,eAAgB,KAAa;EACnC,OAEE,aAAa,eAAe,CAAC,CAAC,OAAO,mBAGrC,aAAa,aAAa,CAAC,CAAC,OAAO,iBACnC,aAAa,aAAa,CAAC,CAAC,OAAO;CAEvC,QAAQ;EACN,OAAO;CACT;AACF"}
|