@formatjs/intl-getcanonicallocales 3.1.0 → 3.1.2

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.js CHANGED
@@ -1,24 +1,18 @@
1
- import { getCanonicalLocales } from './index.js';
2
- import { shouldPolyfill } from './should-polyfill.js';
3
- if (typeof Intl === 'undefined') {
4
- if (typeof window !== 'undefined') {
5
- Object.defineProperty(window, 'Intl', {
6
- value: {},
7
- });
8
- // @ts-ignore we don't include @types/node so global isn't a thing
9
- }
10
- else if (typeof global !== 'undefined') {
11
- // @ts-ignore we don't include @types/node so global isn't a thing
12
- Object.defineProperty(global, 'Intl', {
13
- value: {},
14
- });
15
- }
1
+ import { getCanonicalLocales } from "./index.js";
2
+ import { shouldPolyfill } from "./should-polyfill.js";
3
+ if (typeof Intl === "undefined") {
4
+ if (typeof window !== "undefined") {
5
+ Object.defineProperty(window, "Intl", { value: {} });
6
+ } else if (typeof global !== "undefined") {
7
+ // @ts-ignore we don't include @types/node so global isn't a thing
8
+ Object.defineProperty(global, "Intl", { value: {} });
9
+ }
16
10
  }
17
11
  if (shouldPolyfill()) {
18
- Object.defineProperty(Intl, 'getCanonicalLocales', {
19
- value: getCanonicalLocales,
20
- writable: true,
21
- enumerable: false,
22
- configurable: true,
23
- });
12
+ Object.defineProperty(Intl, "getCanonicalLocales", {
13
+ value: getCanonicalLocales,
14
+ writable: true,
15
+ enumerable: false,
16
+ configurable: true
17
+ });
24
18
  }
@@ -1,8 +1,3 @@
1
1
  export function shouldPolyfill() {
2
- return (typeof Intl === 'undefined' ||
3
- !('getCanonicalLocales' in Intl) ||
4
- // Native Intl.getCanonicalLocales is just buggy
5
- // https://bugs.chromium.org/p/v8/issues/detail?id=10682
6
- Intl.getCanonicalLocales('und-x-private')[0] ===
7
- 'x-private');
2
+ return typeof Intl === "undefined" || !("getCanonicalLocales" in Intl) || Intl.getCanonicalLocales("und-x-private")[0] === "x-private";
8
3
  }
@@ -1,3 +1,5 @@
1
+ /* @generated */
2
+ // prettier-ignore
1
3
  export declare const languageAlias: Record<string, string>;
2
4
  export declare const territoryAlias: Record<string, string>;
3
5
  export declare const scriptAlias: Record<string, string>;