@formatjs/intl-durationformat 0.10.11 → 0.10.12

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@formatjs/intl-durationformat",
3
3
  "description": "Intl.DurationFormat polyfill",
4
- "version": "0.10.11",
4
+ "version": "0.10.12",
5
5
  "license": "MIT",
6
6
  "author": "Long Ho <holevietlong@gmail.com>",
7
7
  "type": "module",
package/polyfill-force.js CHANGED
@@ -178,6 +178,23 @@ const strategies = {
178
178
  };
179
179
  //#endregion
180
180
  //#region packages/ecma402-abstract/utils.js
181
+ function defineProperty(target, name, { value }) {
182
+ Object.defineProperty(target, name, {
183
+ configurable: true,
184
+ enumerable: false,
185
+ writable: true,
186
+ value
187
+ });
188
+ }
189
+ function ensureIntl() {
190
+ if (typeof Intl === "undefined") Object.defineProperty(globalThis, "Intl", {
191
+ configurable: true,
192
+ enumerable: false,
193
+ writable: true,
194
+ value: {}
195
+ });
196
+ return Intl;
197
+ }
181
198
  function invariant$2(condition, message, Err = Error) {
182
199
  if (!condition) throw new Err(message);
183
200
  }
@@ -1716,11 +1733,7 @@ var DurationFormat = class DurationFormat {
1716
1733
  };
1717
1734
  //#endregion
1718
1735
  //#region packages/intl-durationformat/polyfill-force.ts
1719
- if (typeof Intl === "undefined") {
1720
- if (typeof window !== "undefined") Object.defineProperty(window, "Intl", { value: {} });
1721
- else if (typeof global !== "undefined") Object.defineProperty(global, "Intl", { value: {} });
1722
- }
1723
- Object.defineProperty(Intl, "DurationFormat", { value: DurationFormat });
1736
+ defineProperty(ensureIntl(), "DurationFormat", { value: DurationFormat });
1724
1737
  //#endregion
1725
1738
 
1726
1739
  //# sourceMappingURL=polyfill-force.js.map