@xylabs/decimal-precision 2.13.20 → 2.13.21

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.
@@ -25,8 +25,8 @@ __export(src_exports, {
25
25
  module.exports = __toCommonJS(src_exports);
26
26
  var toDecimalPrecision = (value, digits) => {
27
27
  let fixed = 0;
28
- const result = parseFloat(value.toPrecision(digits));
29
- while (parseFloat(result.toFixed(fixed)) !== result && fixed < 20) {
28
+ const result = Number.parseFloat(value.toPrecision(digits));
29
+ while (Number.parseFloat(result.toFixed(fixed)) !== result && fixed < 20) {
30
30
  fixed++;
31
31
  }
32
32
  return result.toFixed(fixed);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export const toDecimalPrecision = (value: number, digits: number) => {\n let fixed = 0\n const result = parseFloat(value.toPrecision(digits))\n while (parseFloat(result.toFixed(fixed)) !== result && fixed < 20) {\n fixed++\n }\n return result.toFixed(fixed)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,IAAM,qBAAqB,CAAC,OAAe,WAAmB;AACnE,MAAI,QAAQ;AACZ,QAAM,SAAS,WAAW,MAAM,YAAY,MAAM,CAAC;AACnD,SAAO,WAAW,OAAO,QAAQ,KAAK,CAAC,MAAM,UAAU,QAAQ,IAAI;AACjE;AAAA,EACF;AACA,SAAO,OAAO,QAAQ,KAAK;AAC7B;","names":[]}
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export const toDecimalPrecision = (value: number, digits: number) => {\n let fixed = 0\n const result = Number.parseFloat(value.toPrecision(digits))\n while (Number.parseFloat(result.toFixed(fixed)) !== result && fixed < 20) {\n fixed++\n }\n return result.toFixed(fixed)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,IAAM,qBAAqB,CAAC,OAAe,WAAmB;AACnE,MAAI,QAAQ;AACZ,QAAM,SAAS,OAAO,WAAW,MAAM,YAAY,MAAM,CAAC;AAC1D,SAAO,OAAO,WAAW,OAAO,QAAQ,KAAK,CAAC,MAAM,UAAU,QAAQ,IAAI;AACxE;AAAA,EACF;AACA,SAAO,OAAO,QAAQ,KAAK;AAC7B;","names":[]}
@@ -1,8 +1,8 @@
1
1
  // src/index.ts
2
2
  var toDecimalPrecision = (value, digits) => {
3
3
  let fixed = 0;
4
- const result = parseFloat(value.toPrecision(digits));
5
- while (parseFloat(result.toFixed(fixed)) !== result && fixed < 20) {
4
+ const result = Number.parseFloat(value.toPrecision(digits));
5
+ while (Number.parseFloat(result.toFixed(fixed)) !== result && fixed < 20) {
6
6
  fixed++;
7
7
  }
8
8
  return result.toFixed(fixed);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export const toDecimalPrecision = (value: number, digits: number) => {\n let fixed = 0\n const result = parseFloat(value.toPrecision(digits))\n while (parseFloat(result.toFixed(fixed)) !== result && fixed < 20) {\n fixed++\n }\n return result.toFixed(fixed)\n}\n"],"mappings":";AAAO,IAAM,qBAAqB,CAAC,OAAe,WAAmB;AACnE,MAAI,QAAQ;AACZ,QAAM,SAAS,WAAW,MAAM,YAAY,MAAM,CAAC;AACnD,SAAO,WAAW,OAAO,QAAQ,KAAK,CAAC,MAAM,UAAU,QAAQ,IAAI;AACjE;AAAA,EACF;AACA,SAAO,OAAO,QAAQ,KAAK;AAC7B;","names":[]}
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export const toDecimalPrecision = (value: number, digits: number) => {\n let fixed = 0\n const result = Number.parseFloat(value.toPrecision(digits))\n while (Number.parseFloat(result.toFixed(fixed)) !== result && fixed < 20) {\n fixed++\n }\n return result.toFixed(fixed)\n}\n"],"mappings":";AAAO,IAAM,qBAAqB,CAAC,OAAe,WAAmB;AACnE,MAAI,QAAQ;AACZ,QAAM,SAAS,OAAO,WAAW,MAAM,YAAY,MAAM,CAAC;AAC1D,SAAO,OAAO,WAAW,OAAO,QAAQ,KAAK,CAAC,MAAM,UAAU,QAAQ,IAAI;AACxE;AAAA,EACF;AACA,SAAO,OAAO,QAAQ,KAAK;AAC7B;","names":[]}
@@ -25,8 +25,8 @@ __export(src_exports, {
25
25
  module.exports = __toCommonJS(src_exports);
26
26
  var toDecimalPrecision = (value, digits) => {
27
27
  let fixed = 0;
28
- const result = parseFloat(value.toPrecision(digits));
29
- while (parseFloat(result.toFixed(fixed)) !== result && fixed < 20) {
28
+ const result = Number.parseFloat(value.toPrecision(digits));
29
+ while (Number.parseFloat(result.toFixed(fixed)) !== result && fixed < 20) {
30
30
  fixed++;
31
31
  }
32
32
  return result.toFixed(fixed);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export const toDecimalPrecision = (value: number, digits: number) => {\n let fixed = 0\n const result = parseFloat(value.toPrecision(digits))\n while (parseFloat(result.toFixed(fixed)) !== result && fixed < 20) {\n fixed++\n }\n return result.toFixed(fixed)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,IAAM,qBAAqB,CAAC,OAAe,WAAmB;AACnE,MAAI,QAAQ;AACZ,QAAM,SAAS,WAAW,MAAM,YAAY,MAAM,CAAC;AACnD,SAAO,WAAW,OAAO,QAAQ,KAAK,CAAC,MAAM,UAAU,QAAQ,IAAI;AACjE;AAAA,EACF;AACA,SAAO,OAAO,QAAQ,KAAK;AAC7B;","names":[]}
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export const toDecimalPrecision = (value: number, digits: number) => {\n let fixed = 0\n const result = Number.parseFloat(value.toPrecision(digits))\n while (Number.parseFloat(result.toFixed(fixed)) !== result && fixed < 20) {\n fixed++\n }\n return result.toFixed(fixed)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,IAAM,qBAAqB,CAAC,OAAe,WAAmB;AACnE,MAAI,QAAQ;AACZ,QAAM,SAAS,OAAO,WAAW,MAAM,YAAY,MAAM,CAAC;AAC1D,SAAO,OAAO,WAAW,OAAO,QAAQ,KAAK,CAAC,MAAM,UAAU,QAAQ,IAAI;AACxE;AAAA,EACF;AACA,SAAO,OAAO,QAAQ,KAAK;AAC7B;","names":[]}
@@ -1,8 +1,8 @@
1
1
  // src/index.ts
2
2
  var toDecimalPrecision = (value, digits) => {
3
3
  let fixed = 0;
4
- const result = parseFloat(value.toPrecision(digits));
5
- while (parseFloat(result.toFixed(fixed)) !== result && fixed < 20) {
4
+ const result = Number.parseFloat(value.toPrecision(digits));
5
+ while (Number.parseFloat(result.toFixed(fixed)) !== result && fixed < 20) {
6
6
  fixed++;
7
7
  }
8
8
  return result.toFixed(fixed);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export const toDecimalPrecision = (value: number, digits: number) => {\n let fixed = 0\n const result = parseFloat(value.toPrecision(digits))\n while (parseFloat(result.toFixed(fixed)) !== result && fixed < 20) {\n fixed++\n }\n return result.toFixed(fixed)\n}\n"],"mappings":";AAAO,IAAM,qBAAqB,CAAC,OAAe,WAAmB;AACnE,MAAI,QAAQ;AACZ,QAAM,SAAS,WAAW,MAAM,YAAY,MAAM,CAAC;AACnD,SAAO,WAAW,OAAO,QAAQ,KAAK,CAAC,MAAM,UAAU,QAAQ,IAAI;AACjE;AAAA,EACF;AACA,SAAO,OAAO,QAAQ,KAAK;AAC7B;","names":[]}
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export const toDecimalPrecision = (value: number, digits: number) => {\n let fixed = 0\n const result = Number.parseFloat(value.toPrecision(digits))\n while (Number.parseFloat(result.toFixed(fixed)) !== result && fixed < 20) {\n fixed++\n }\n return result.toFixed(fixed)\n}\n"],"mappings":";AAAO,IAAM,qBAAqB,CAAC,OAAe,WAAmB;AACnE,MAAI,QAAQ;AACZ,QAAM,SAAS,OAAO,WAAW,MAAM,YAAY,MAAM,CAAC;AAC1D,SAAO,OAAO,WAAW,OAAO,QAAQ,KAAK,CAAC,MAAM,UAAU,QAAQ,IAAI;AACxE;AAAA,EACF;AACA,SAAO,OAAO,QAAQ,KAAK;AAC7B;","names":[]}
package/package.json CHANGED
@@ -29,15 +29,20 @@
29
29
  "module": "./dist/node/index.js",
30
30
  "homepage": "https://xylabs.com",
31
31
  "keywords": [
32
+ "decimal",
33
+ "precision",
32
34
  "xylabs",
33
35
  "utility",
34
36
  "typescript",
35
37
  "esm"
36
38
  ],
37
39
  "devDependencies": {
38
- "@xylabs/ts-scripts-yarn3": "^3.2.10",
39
- "@xylabs/tsconfig": "^3.2.10",
40
- "typescript": "^5.3.2"
40
+ "@xylabs/ts-scripts-yarn3": "^3.2.25",
41
+ "@xylabs/tsconfig": "^3.2.25",
42
+ "typescript": "^5.3.3"
43
+ },
44
+ "engines": {
45
+ "node": ">=18"
41
46
  },
42
47
  "publishConfig": {
43
48
  "access": "public"
@@ -47,6 +52,6 @@
47
52
  "url": "https://github.com/xylabs/sdk-js.git"
48
53
  },
49
54
  "sideEffects": false,
50
- "version": "2.13.20",
55
+ "version": "2.13.21",
51
56
  "type": "module"
52
57
  }
package/src/index.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export const toDecimalPrecision = (value: number, digits: number) => {
2
2
  let fixed = 0
3
- const result = parseFloat(value.toPrecision(digits))
4
- while (parseFloat(result.toFixed(fixed)) !== result && fixed < 20) {
3
+ const result = Number.parseFloat(value.toPrecision(digits))
4
+ while (Number.parseFloat(result.toFixed(fixed)) !== result && fixed < 20) {
5
5
  fixed++
6
6
  }
7
7
  return result.toFixed(fixed)