@quentinadam/decimal 0.1.11 → 0.1.14

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/dist/Decimal.d.ts CHANGED
@@ -6,6 +6,7 @@ export type DecimalType = Decimal | number | bigint | string;
6
6
  * A class to represent arbitrary precision decimal numbers.
7
7
  */
8
8
  export default class Decimal {
9
+ #private;
9
10
  readonly mantissa: bigint;
10
11
  readonly exponent: number;
11
12
  /**
package/dist/Decimal.js CHANGED
@@ -39,6 +39,21 @@ export default class Decimal {
39
39
  * @returns A string representing the Decimal value.
40
40
  */
41
41
  [Symbol.for('Deno.customInspect')](inspect, options) {
42
+ return this.#customInspect(inspect, options);
43
+ }
44
+ /**
45
+ * Custom inspection method for Node.js/Bun which returns the string representation of the Decimal instance.
46
+ *
47
+ * @returns A string representing the Decimal value.
48
+ */
49
+ [Symbol.for('nodejs.util.inspect.custom')](_depth, options, inspect) {
50
+ return this.#customInspect(inspect, options);
51
+ }
52
+ #customInspect(inspect, options) {
53
+ const stylize = options.stylize;
54
+ if (typeof stylize === 'function') {
55
+ return stylize(this.toString(), 'number');
56
+ }
42
57
  const coloredNumber = inspect(0, options);
43
58
  // deno-lint-ignore no-control-regex
44
59
  const start = coloredNumber.match(/^\x1b\[[0-9;]*m/)?.[0] ?? '';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quentinadam/decimal",
3
- "version": "0.1.11",
3
+ "version": "0.1.14",
4
4
  "description": "A library for working with arbitrary precision decimal numbers",
5
5
  "license": "MIT",
6
6
  "author": "Quentin Adam",
@@ -15,6 +15,6 @@
15
15
  "README.md"
16
16
  ],
17
17
  "dependencies": {
18
- "@quentinadam/assert": "^0.1.12"
18
+ "@quentinadam/assert": "^0.1.13"
19
19
  }
20
20
  }