@formatjs/intl-getcanonicallocales 3.3.1 → 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/polyfill.iife.js CHANGED
@@ -9486,6 +9486,8 @@ function compareKV(t1, t2) {
9486
9486
  return t1[0] < t2[0] ? -1 : t1[0] > t2[0] ? 1 : 0;
9487
9487
  }
9488
9488
  function compareExtension(e1, e2) {
9489
+ if (e1.type === "x") return e2.type === "x" ? 0 : 1;
9490
+ if (e2.type === "x") return -1;
9489
9491
  return e1.type < e2.type ? -1 : e1.type > e2.type ? 1 : 0;
9490
9492
  }
9491
9493
  function mergeVariants(v1, v2) {
@@ -9653,7 +9655,13 @@ function getCanonicalLocales(locales) {
9653
9655
  }
9654
9656
  // packages/intl-getcanonicallocales/should-polyfill.ts
9655
9657
  function shouldPolyfill() {
9656
- return typeof Intl === "undefined" || !("getCanonicalLocales" in Intl) || Intl.getCanonicalLocales("und-x-private")[0] === "x-private";
9658
+ if (typeof Intl === "undefined" || typeof Intl.getCanonicalLocales !== "function") return true;
9659
+ try {
9660
+ const canonicalize = Intl.getCanonicalLocales;
9661
+ 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";
9662
+ } catch {
9663
+ return true;
9664
+ }
9657
9665
  }
9658
9666
  // node_modules/.aspect_rules_js/@formatjs+fast-memoize@0.0.0/node_modules/@formatjs/fast-memoize/index.js
9659
9667
  function memoize(fn, options) {
package/polyfill.js CHANGED
@@ -9486,6 +9486,8 @@ function compareKV(t1, t2) {
9486
9486
  return t1[0] < t2[0] ? -1 : t1[0] > t2[0] ? 1 : 0;
9487
9487
  }
9488
9488
  function compareExtension(e1, e2) {
9489
+ if (e1.type === "x") return e2.type === "x" ? 0 : 1;
9490
+ if (e2.type === "x") return -1;
9489
9491
  return e1.type < e2.type ? -1 : e1.type > e2.type ? 1 : 0;
9490
9492
  }
9491
9493
  function mergeVariants(v1, v2) {
@@ -9653,7 +9655,13 @@ function getCanonicalLocales(locales) {
9653
9655
  }
9654
9656
  // packages/intl-getcanonicallocales/should-polyfill.ts
9655
9657
  function shouldPolyfill() {
9656
- return typeof Intl === "undefined" || !("getCanonicalLocales" in Intl) || Intl.getCanonicalLocales("und-x-private")[0] === "x-private";
9658
+ if (typeof Intl === "undefined" || typeof Intl.getCanonicalLocales !== "function") return true;
9659
+ try {
9660
+ const canonicalize = Intl.getCanonicalLocales;
9661
+ 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";
9662
+ } catch {
9663
+ return true;
9664
+ }
9657
9665
  }
9658
9666
  // node_modules/.aspect_rules_js/@formatjs+fast-memoize@0.0.0/node_modules/@formatjs/fast-memoize/index.js
9659
9667
  function memoize(fn, options) {