@augment-vir/common 31.15.0 → 31.17.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.
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Round a value to the given number of decimal digits. If no decimal value is present, no rounding
3
- * occurs.
2
+ * Round a value to the given number of decimal digits. If no decimal value is present, or if
3
+ * `undefined` digits are given, no rounding occurs.
4
4
  *
5
5
  * @category Number
6
6
  * @category Package : @augment-vir/common
@@ -17,6 +17,7 @@
17
17
  *
18
18
  * @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common)
19
19
  */
20
- export declare function round(value: number, { digits }: {
21
- digits: number;
20
+ export declare function round(value: number, { digits, }: {
21
+ /** The number of digits to round to. Set to `undefined` to disable rounding. */
22
+ digits: number | undefined;
22
23
  }): number;
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Round a value to the given number of decimal digits. If no decimal value is present, no rounding
3
- * occurs.
2
+ * Round a value to the given number of decimal digits. If no decimal value is present, or if
3
+ * `undefined` digits are given, no rounding occurs.
4
4
  *
5
5
  * @category Number
6
6
  * @category Package : @augment-vir/common
@@ -17,7 +17,10 @@
17
17
  *
18
18
  * @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common)
19
19
  */
20
- export function round(value, { digits }) {
20
+ export function round(value, { digits, }) {
21
+ if (digits == undefined) {
22
+ return value;
23
+ }
21
24
  const digitFactor = Math.pow(10, digits);
22
25
  const multiplied = value * digitFactor;
23
26
  return Number((Math.round(multiplied) / digitFactor).toFixed(digits));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@augment-vir/common",
3
- "version": "31.15.0",
3
+ "version": "31.17.0",
4
4
  "description": "A collection of augments, helpers types, functions, and classes for any JavaScript environment.",
5
5
  "keywords": [
6
6
  "augment",
@@ -40,13 +40,13 @@
40
40
  "test:web": "virmator --no-deps test web"
41
41
  },
42
42
  "dependencies": {
43
- "@augment-vir/assert": "^31.15.0",
44
- "@augment-vir/core": "^31.15.0",
43
+ "@augment-vir/assert": "^31.17.0",
44
+ "@augment-vir/core": "^31.17.0",
45
45
  "@date-vir/duration": "^7.3.1",
46
46
  "ansi-styles": "^6.2.1",
47
47
  "json5": "^2.2.3",
48
- "type-fest": "^4.40.0",
49
- "typed-event-target": "^4.0.3"
48
+ "type-fest": "^4.40.1",
49
+ "typed-event-target": "^4.0.4"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@web/dev-server-esbuild": "^1.0.4",