@formatjs/ecma402-abstract 3.1.1 → 3.2.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/262.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Decimal } from "decimal.js";
1
+ import { Decimal } from "@formatjs/bigdecimal";
2
2
  /**
3
3
  * https://tc39.es/ecma262/#sec-tostring
4
4
  */
package/262.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Decimal } from "decimal.js";
1
+ import { Decimal } from "@formatjs/bigdecimal";
2
2
  import { ZERO } from "./constants.js";
3
3
  import { invariant } from "./utils.js";
4
4
  /**
@@ -1,3 +1,3 @@
1
- import type { Decimal } from "decimal.js";
1
+ import type { Decimal } from "@formatjs/bigdecimal";
2
2
  import { type UnsignedRoundingModeType } from "../types/number.js";
3
3
  export declare function ApplyUnsignedRoundingMode(x: Decimal, r1: Decimal, r2: Decimal, unsignedRoundingMode: UnsignedRoundingModeType): Decimal;
@@ -1,4 +1,4 @@
1
- import { Decimal } from "decimal.js";
1
+ import { Decimal } from "@formatjs/bigdecimal";
2
2
  import { type NumberFormatInternal } from "../types/number.js";
3
3
  /**
4
4
  * The abstract operation ComputeExponent computes an exponent (power of ten) by which to scale x
@@ -1,4 +1,4 @@
1
- import { Decimal } from "decimal.js";
1
+ import { Decimal } from "@formatjs/bigdecimal";
2
2
  import "../types/number.js";
3
3
  import { ComputeExponentForMagnitude } from "./ComputeExponentForMagnitude.js";
4
4
  import { FormatNumericToString } from "./FormatNumericToString.js";
@@ -1,4 +1,4 @@
1
- import { Decimal } from "decimal.js";
1
+ import type { Decimal } from "@formatjs/bigdecimal";
2
2
  import { type NumberFormatInternal } from "../types/number.js";
3
3
  /**
4
4
  * The abstract operation ComputeExponentForMagnitude computes an exponent by which to scale a
@@ -1,8 +1,6 @@
1
- import { Decimal } from "decimal.js";
2
1
  import "../types/number.js";
3
2
  import { invariant } from "../utils.js";
4
3
  import { getPowerOf10 } from "./decimal-cache.js";
5
- Decimal.set({ toExpPos: 100 });
6
4
  /**
7
5
  * The abstract operation ComputeExponentForMagnitude computes an exponent by which to scale a
8
6
  * number of the given magnitude (power of ten of the most significant digit) according to the
@@ -1,3 +1,3 @@
1
- import type { Decimal } from "decimal.js";
1
+ import type { Decimal } from "@formatjs/bigdecimal";
2
2
  import { type NumberFormatInternal } from "../types/number.js";
3
3
  export declare function FormatNumeric(internalSlots: NumberFormatInternal, x: Decimal): string;
@@ -1,4 +1,4 @@
1
- import type { Decimal } from "decimal.js";
1
+ import type { Decimal } from "@formatjs/bigdecimal";
2
2
  import { type NumberFormatInternal } from "../types/number.js";
3
3
  /**
4
4
  * https://tc39.es/ecma402/#sec-formatnumericrange
@@ -1,4 +1,4 @@
1
- import type { Decimal } from "decimal.js";
1
+ import type { Decimal } from "@formatjs/bigdecimal";
2
2
  import { type NumberFormatInternal, type NumberRangeToParts } from "../types/number.js";
3
3
  /**
4
4
  * https://tc39.es/ecma402/#sec-formatnumericrangetoparts
@@ -1,4 +1,4 @@
1
- import type { Decimal } from "decimal.js";
1
+ import type { Decimal } from "@formatjs/bigdecimal";
2
2
  import { type NumberFormatInternal, type NumberFormatPart } from "../types/number.js";
3
3
  export declare function FormatNumericToParts(nf: Intl.NumberFormat, x: Decimal, implDetails: {
4
4
  getInternalSlots(nf: Intl.NumberFormat): NumberFormatInternal;
@@ -1,4 +1,4 @@
1
- import type { Decimal } from "decimal.js";
1
+ import type { Decimal } from "@formatjs/bigdecimal";
2
2
  import { type NumberFormatDigitInternalSlots } from "../types/number.js";
3
3
  /**
4
4
  * https://tc39.es/ecma402/#sec-formatnumberstring
@@ -1,4 +1,4 @@
1
- import type { Decimal } from "decimal.js";
1
+ import type { Decimal } from "@formatjs/bigdecimal";
2
2
  import { type NumberFormatInternal, type NumberFormatPart } from "../types/number.js";
3
3
  /**
4
4
  * https://tc39.es/ecma402/#sec-partitionnumberpattern
@@ -1,4 +1,4 @@
1
- import type { Decimal } from "decimal.js";
1
+ import type { Decimal } from "@formatjs/bigdecimal";
2
2
  import { type NumberFormatInternal, type NumberFormatPart } from "../types/number.js";
3
3
  /**
4
4
  * https://tc39.es/ecma402/#sec-partitionnumberrangepattern
@@ -1,4 +1,4 @@
1
- import { Decimal } from "decimal.js";
1
+ import type { Decimal } from "@formatjs/bigdecimal";
2
2
  import { type RawNumberFormatResult, type UnsignedRoundingModeType } from "../types/number.js";
3
3
  /**
4
4
  * https://tc39.es/ecma402/#sec-torawfixed
@@ -1,10 +1,7 @@
1
- import { Decimal } from "decimal.js";
2
1
  import "../types/number.js";
3
2
  import { repeat } from "../utils.js";
4
3
  import { ApplyUnsignedRoundingMode } from "./ApplyUnsignedRoundingMode.js";
5
4
  import { getPowerOf10 } from "./decimal-cache.js";
6
- //IMPL: Setting Decimal configuration
7
- Decimal.set({ toExpPos: 100 });
8
5
  //IMPL: Helper function to calculate raw fixed value
9
6
  function ToRawFixedFn(n, f) {
10
7
  return n.times(getPowerOf10(-f));
@@ -1,4 +1,4 @@
1
- import type { Decimal } from "decimal.js";
1
+ import type { Decimal } from "@formatjs/bigdecimal";
2
2
  import { type RawNumberFormatResult, type UnsignedRoundingModeType } from "../types/number.js";
3
3
  /**
4
4
  * https://tc39.es/ecma402/#sec-torawprecision
@@ -1,4 +1,4 @@
1
- import { Decimal } from "decimal.js";
1
+ import { Decimal } from "@formatjs/bigdecimal";
2
2
  /**
3
3
  * Cached function to compute powers of 10 for Decimal.js operations.
4
4
  * This cache significantly reduces overhead in ComputeExponent and ToRawFixed
@@ -1,4 +1,4 @@
1
- import { Decimal } from "decimal.js";
1
+ import { Decimal } from "@formatjs/bigdecimal";
2
2
  import { memoize } from "@formatjs/fast-memoize";
3
3
  /**
4
4
  * Cached function to compute powers of 10 for Decimal.js operations.
@@ -1,4 +1,4 @@
1
- import { Decimal } from "decimal.js";
1
+ import { Decimal } from "@formatjs/bigdecimal";
2
2
  import { type NumberFormatLocaleInternalData, type NumberFormatOptionsCompactDisplay, type NumberFormatOptionsCurrencyDisplay, type NumberFormatOptionsCurrencySign, type NumberFormatOptionsNotation, type NumberFormatOptionsStyle, type NumberFormatOptionsUnitDisplay, type NumberFormatPart, type RoundingModeType, type UseGroupingType } from "../types/number.js";
3
3
  interface NumberResult {
4
4
  formattedString: string;
@@ -1,4 +1,4 @@
1
- import { Decimal } from "decimal.js";
1
+ import { Decimal } from "@formatjs/bigdecimal";
2
2
  import { S_UNICODE_REGEX } from "../regex.generated.js";
3
3
  import "../types/number.js";
4
4
  import { getPowerOf10 } from "./decimal-cache.js";
@@ -1,4 +1,4 @@
1
- import { Decimal } from "decimal.js";
1
+ import { Decimal } from "@formatjs/bigdecimal";
2
2
  /**
3
3
  * https://tc39.es/ecma402/#sec-tointlmathematicalvalue
4
4
  * Converts input to a mathematical value, supporting BigInt
@@ -1,4 +1,4 @@
1
- import { Decimal } from "decimal.js";
1
+ import { Decimal } from "@formatjs/bigdecimal";
2
2
  import { ToPrimitive } from "./262.js";
3
3
  /**
4
4
  * https://tc39.es/ecma402/#sec-tointlmathematicalvalue
package/constants.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Decimal } from "decimal.js";
1
+ import { Decimal } from "@formatjs/bigdecimal";
2
2
  export declare const TEN: Decimal;
3
3
  export declare const ZERO: Decimal;
4
4
  export declare const NEGATIVE_ZERO: Decimal;
package/constants.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Decimal } from "decimal.js";
1
+ import { Decimal } from "@formatjs/bigdecimal";
2
2
  export const TEN = new Decimal(10);
3
3
  export const ZERO = new Decimal(0);
4
4
  export const NEGATIVE_ZERO = new Decimal(-0);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@formatjs/ecma402-abstract",
3
3
  "description": "A collection of implementation for ECMAScript abstract operations",
4
- "version": "3.1.1",
4
+ "version": "3.2.0",
5
5
  "license": "MIT",
6
6
  "author": "Long Ho <holevietlong@gmail.com",
7
7
  "type": "module",
@@ -11,10 +11,9 @@
11
11
  ".": "./index.js"
12
12
  },
13
13
  "dependencies": {
14
- "decimal.js": "^10.6.0",
15
- "tslib": "^2.8.1",
16
- "@formatjs/fast-memoize": "3.1.0",
17
- "@formatjs/intl-localematcher": "0.8.1"
14
+ "@formatjs/bigdecimal": "0.2.0",
15
+ "@formatjs/fast-memoize": "3.1.1",
16
+ "@formatjs/intl-localematcher": "0.8.2"
18
17
  },
19
18
  "bugs": "https://github.com/formatjs/formatjs/issues",
20
19
  "gitHead": "a7842673d8ad205171ad7c8cb8bb2f318b427c0c",
package/types/number.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Decimal } from "decimal.js";
1
+ import type { Decimal } from "@formatjs/bigdecimal";
2
2
  import { type LocaleData } from "./core.js";
3
3
  import { type LDMLPluralRule } from "./plural-rules.js";
4
4
  export type NumberFormatNotation = "standard" | "scientific" | "engineering" | "compact";