@formatjs/intl-pluralrules 6.3.9 → 6.3.11

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,37 +1,35 @@
1
1
  {
2
2
  "name": "@formatjs/intl-pluralrules",
3
+ "version": "6.3.11",
3
4
  "description": "Polyfill for Intl.PluralRules",
4
- "version": "6.3.9",
5
+ "keywords": [
6
+ "PluralRules",
7
+ "i18n",
8
+ "intl",
9
+ "plural",
10
+ "polyfill",
11
+ "rules"
12
+ ],
13
+ "homepage": "https://github.com/formatjs/formatjs",
14
+ "bugs": "https://github.com/formatjs/formatjs/issues",
5
15
  "license": "MIT",
6
16
  "author": "Long Ho <holevietlong@gmail.com>",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "formatjs/formatjs.git"
20
+ },
7
21
  "type": "module",
8
22
  "types": "index.d.ts",
9
23
  "exports": {
10
24
  ".": "./index.js",
11
- "./polyfill.js": "./polyfill.js",
12
- "./polyfill-force.js": "./polyfill-force.js",
13
- "./should-polyfill.js": "./should-polyfill.js",
25
+ "./locale-data": "./locale-data",
14
26
  "./locale-data/*": "./locale-data/*",
15
- "./locale-data": "./locale-data"
27
+ "./polyfill-force.js": "./polyfill-force.js",
28
+ "./polyfill.js": "./polyfill.js",
29
+ "./should-polyfill.js": "./should-polyfill.js"
16
30
  },
17
31
  "dependencies": {
18
- "@formatjs/bigdecimal": "0.2.5",
19
- "@formatjs/intl-localematcher": "0.8.9"
20
- },
21
- "devDependencies": {
22
- "@formatjs/intl-getcanonicallocales": "3.2.9",
23
- "@formatjs/intl-locale": "5.3.8"
24
- },
25
- "bugs": "https://github.com/formatjs/formatjs/issues",
26
- "gitHead": "a7842673d8ad205171ad7c8cb8bb2f318b427c0c",
27
- "homepage": "https://github.com/formatjs/formatjs",
28
- "keywords": [
29
- "i18n",
30
- "intl",
31
- "plural",
32
- "PluralRules",
33
- "polyfill",
34
- "rules"
35
- ],
36
- "repository": "formatjs/formatjs.git"
32
+ "@formatjs/bigdecimal": "0.2.6",
33
+ "@formatjs/intl-localematcher": "0.8.11"
34
+ }
37
35
  }
package/polyfill-force.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { LookupSupportedLocales, ResolveLocale } from "@formatjs/intl-localematcher";
2
- import Decimal, { Decimal as Decimal$1 } from "@formatjs/bigdecimal";
2
+ import Decimal$1, { Decimal } from "@formatjs/bigdecimal";
3
3
  //#region packages/ecma402-abstract/CanonicalizeLocaleList.js
4
4
  /**
5
5
  * http://ecma-international.org/ecma-402/7.0/index.html#sec-canonicalizelocalelist
@@ -116,16 +116,16 @@ function ToPrimitive(input, preferredType) {
116
116
  * Converts input to a mathematical value, supporting BigInt
117
117
  */
118
118
  function ToIntlMathematicalValue(input) {
119
- if (typeof input === "bigint") return new Decimal$1(input.toString());
119
+ if (typeof input === "bigint") return new Decimal(input.toString());
120
120
  let primValue = ToPrimitive(input, "number");
121
- if (primValue === void 0) return new Decimal$1(NaN);
122
- if (primValue === true) return new Decimal$1(1);
123
- if (primValue === false) return new Decimal$1(0);
124
- if (primValue === null) return new Decimal$1(0);
121
+ if (primValue === void 0) return new Decimal(NaN);
122
+ if (primValue === true) return new Decimal(1);
123
+ if (primValue === false) return new Decimal(0);
124
+ if (primValue === null) return new Decimal(0);
125
125
  try {
126
- return new Decimal$1(primValue);
126
+ return new Decimal(primValue);
127
127
  } catch {
128
- return new Decimal$1(NaN);
128
+ return new Decimal(NaN);
129
129
  }
130
130
  }
131
131
  //#endregion
@@ -267,7 +267,7 @@ memoize((...args) => new Intl.PluralRules(...args), { strategy: strategies.varia
267
267
  memoize((...args) => new Intl.ListFormat(...args), { strategy: strategies.variadic });
268
268
  //#endregion
269
269
  //#region packages/ecma402-abstract/NumberFormat/SetNumberFormatDigitOptions.js
270
- const VALID_ROUNDING_INCREMENTS = new Set([
270
+ const VALID_ROUNDING_INCREMENTS = /* @__PURE__ */ new Set([
271
271
  1,
272
272
  2,
273
273
  5,
@@ -421,7 +421,7 @@ function Type(x) {
421
421
  * @param exponent - Can be a number or Decimal. If Decimal, it will be converted to string for cache key.
422
422
  */
423
423
  const getPowerOf10 = memoize((exponent) => {
424
- return Decimal$1.pow(10, exponent);
424
+ return Decimal.pow(10, exponent);
425
425
  });
426
426
  //#endregion
427
427
  //#region packages/ecma402-abstract/NumberFormat/ComputeExponentForMagnitude.js
@@ -464,8 +464,8 @@ function ComputeExponentForMagnitude(internalSlots, magnitude) {
464
464
  }
465
465
  //#endregion
466
466
  //#region packages/ecma402-abstract/constants.js
467
- const ZERO$1 = new Decimal$1(0);
468
- const NEGATIVE_ZERO = new Decimal$1(-0);
467
+ const ZERO$1 = new Decimal(0);
468
+ const NEGATIVE_ZERO = new Decimal(-0);
469
469
  //#endregion
470
470
  //#region packages/ecma402-abstract/NumberFormat/GetUnsignedRoundingMode.js
471
471
  const negativeMapping = {
@@ -772,7 +772,7 @@ function FormatNumericToString(intlObject, _x) {
772
772
  }
773
773
  //#endregion
774
774
  //#region packages/ecma262-abstract/ToNumber.js
775
- const ZERO = new Decimal$1(0);
775
+ const ZERO = new Decimal(0);
776
776
  function invariant(condition, message, Err = Error) {
777
777
  if (!condition) throw new Err(message);
778
778
  }
@@ -780,16 +780,16 @@ function invariant(condition, message, Err = Error) {
780
780
  * https://tc39.es/ecma262/#sec-tonumber
781
781
  */
782
782
  function ToNumber(arg) {
783
- if (typeof arg === "number") return new Decimal$1(arg);
784
- if (typeof arg === "bigint") return new Decimal$1(arg.toString());
783
+ if (typeof arg === "number") return new Decimal(arg);
784
+ if (typeof arg === "bigint") return new Decimal(arg.toString());
785
785
  invariant(typeof arg !== "symbol", "Symbol is not supported", TypeError);
786
- if (arg === void 0) return new Decimal$1(NaN);
786
+ if (arg === void 0) return new Decimal(NaN);
787
787
  if (arg === null || arg === 0) return ZERO;
788
- if (arg === true) return new Decimal$1(1);
788
+ if (arg === true) return new Decimal(1);
789
789
  if (typeof arg === "string") try {
790
- return new Decimal$1(arg);
790
+ return new Decimal(arg);
791
791
  } catch {
792
- return new Decimal$1(NaN);
792
+ return new Decimal(NaN);
793
793
  }
794
794
  invariant(typeof arg === "object", "object expected", TypeError);
795
795
  let primValue = ToPrimitive(arg, "number");
@@ -877,7 +877,7 @@ function ResolvePluralInternal(pl, n, { getInternalSlots, PluralRuleSelect }) {
877
877
  let exponent = 0;
878
878
  if (notation === "compact" && !n.isZero()) {
879
879
  if (internalSlots.dataLocaleData?.numbers) try {
880
- exponent = ComputeExponentForMagnitude(internalSlots, new Decimal(Math.floor(Math.log10(Math.abs(n.toNumber())))));
880
+ exponent = ComputeExponentForMagnitude(internalSlots, new Decimal$1(Math.floor(Math.log10(Math.abs(n.toNumber())))));
881
881
  } catch {
882
882
  exponent = 0;
883
883
  }