@xylabs/decimal-precision 2.11.7 → 2.11.9

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,UAAW,MAAM,UAAU,MAAM,WAO/D,CAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,UAAW,MAAM,UAAU,MAAM,WAO/D,CAAA"}
@@ -0,0 +1,12 @@
1
+ const toDecimalPrecision = (value, digits) => {
2
+ let fixed = 0;
3
+ const result = parseFloat(value.toPrecision(digits));
4
+ while (parseFloat(result.toFixed(fixed)) !== result && fixed < 20) {
5
+ fixed++;
6
+ }
7
+ return result.toFixed(fixed);
8
+ };
9
+ export {
10
+ toDecimalPrecision
11
+ };
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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,MAAM,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":[]}
@@ -0,0 +1,2 @@
1
+ export declare const toDecimalPrecision: (value: number, digits: number) => string;
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,UAAW,MAAM,UAAU,MAAM,WAO/D,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const toDecimalPrecision: (value: number, digits: number) => string;
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,UAAW,MAAM,UAAU,MAAM,WAO/D,CAAA"}
@@ -16,14 +16,12 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/index.ts
21
19
  var src_exports = {};
22
20
  __export(src_exports, {
23
21
  toDecimalPrecision: () => toDecimalPrecision
24
22
  });
25
23
  module.exports = __toCommonJS(src_exports);
26
- var toDecimalPrecision = (value, digits) => {
24
+ const toDecimalPrecision = (value, digits) => {
27
25
  let fixed = 0;
28
26
  const result = parseFloat(value.toPrecision(digits));
29
27
  while (parseFloat(result.toFixed(fixed)) !== result && fixed < 20) {
@@ -0,0 +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,MAAM,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,5 +1,4 @@
1
- // src/index.ts
2
- var toDecimalPrecision = (value, digits) => {
1
+ const toDecimalPrecision = (value, digits) => {
3
2
  let fixed = 0;
4
3
  const result = parseFloat(value.toPrecision(digits));
5
4
  while (parseFloat(result.toFixed(fixed)) !== result && fixed < 20) {
@@ -0,0 +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,MAAM,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":[]}
package/package.json CHANGED
@@ -12,16 +12,16 @@
12
12
  },
13
13
  "description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",
14
14
  "docs": "dist/docs.json",
15
- "types": "dist/index.d.ts",
15
+ "types": "dist/node/index.d.ts",
16
16
  "exports": {
17
17
  ".": {
18
18
  "require": {
19
- "types": "./dist/index.d.ts",
20
- "default": "./dist/index.js"
19
+ "types": "./dist/node/index.d.ts",
20
+ "default": "./dist/node/index.js"
21
21
  },
22
22
  "import": {
23
- "types": "./dist/index.d.mts",
24
- "default": "./dist/index.mjs"
23
+ "types": "./dist/node/index.d.mts",
24
+ "default": "./dist/node/index.mjs"
25
25
  }
26
26
  },
27
27
  "./docs": {
@@ -29,8 +29,8 @@
29
29
  },
30
30
  "./package.json": "./package.json"
31
31
  },
32
- "main": "dist/index.js",
33
- "module": "dist/index.mjs",
32
+ "main": "dist/node/index.js",
33
+ "module": "dist/node/index.mjs",
34
34
  "homepage": "https://xylabs.com",
35
35
  "keywords": [
36
36
  "xylabs",
@@ -39,8 +39,8 @@
39
39
  "esm"
40
40
  ],
41
41
  "devDependencies": {
42
- "@xylabs/ts-scripts-yarn3": "^3.0.28",
43
- "@xylabs/tsconfig": "^3.0.28",
42
+ "@xylabs/ts-scripts-yarn3": "^3.0.55",
43
+ "@xylabs/tsconfig": "^3.0.55",
44
44
  "typescript": "^5.2.2"
45
45
  },
46
46
  "publishConfig": {
@@ -51,5 +51,5 @@
51
51
  "url": "https://github.com/xylabs/sdk-js.git"
52
52
  },
53
53
  "sideEffects": false,
54
- "version": "2.11.7"
54
+ "version": "2.11.9"
55
55
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,UAAW,MAAM,UAAU,MAAM,WAO/D,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,UAAW,MAAM,UAAU,MAAM,WAO/D,CAAA"}
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
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 +0,0 @@
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":[]}
File without changes
File without changes