@xylabs/decimal-precision 3.6.12 → 4.0.1

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,2 +1,3 @@
1
- export declare const toDecimalPrecision: (value: number, digits: number) => string;
2
- //# sourceMappingURL=index.d.ts.map
1
+ declare const toDecimalPrecision: (value: number, digits: number) => string;
2
+
3
+ export { toDecimalPrecision };
package/package.json CHANGED
@@ -13,18 +13,11 @@
13
13
  "description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",
14
14
  "exports": {
15
15
  ".": {
16
- "require": {
17
- "types": "./dist/neutral/index.d.cts",
18
- "default": "./dist/neutral/index.cjs"
19
- },
20
- "import": {
21
- "types": "./dist/neutral/index.d.ts",
22
- "default": "./dist/neutral/index.mjs"
23
- }
16
+ "types": "./dist/neutral/index.d.ts",
17
+ "default": "./dist/neutral/index.mjs"
24
18
  },
25
19
  "./package.json": "./package.json"
26
20
  },
27
- "main": "./dist/neutral/index.cjs",
28
21
  "types": "./dist/neutral/index.d.ts",
29
22
  "module": "./dist/neutral/index.mjs",
30
23
  "homepage": "https://xylabs.com",
@@ -37,8 +30,8 @@
37
30
  "esm"
38
31
  ],
39
32
  "devDependencies": {
40
- "@xylabs/ts-scripts-yarn3": "^3.15.14",
41
- "@xylabs/tsconfig": "^3.15.14",
33
+ "@xylabs/ts-scripts-yarn3": "^4.0.0-rc.15",
34
+ "@xylabs/tsconfig": "^4.0.0-rc.15",
42
35
  "typescript": "^5.5.4"
43
36
  },
44
37
  "engines": {
@@ -52,6 +45,6 @@
52
45
  "url": "https://github.com/xylabs/sdk-js.git"
53
46
  },
54
47
  "sideEffects": false,
55
- "version": "3.6.12",
48
+ "version": "4.0.1",
56
49
  "type": "module"
57
50
  }
package/xy.config.ts ADDED
@@ -0,0 +1,12 @@
1
+ import { XyTsupConfig } from '@xylabs/ts-scripts-yarn3'
2
+ const config: XyTsupConfig = {
3
+ compile: {
4
+ browser: {},
5
+ neutral: {
6
+ src: true,
7
+ },
8
+ node: {},
9
+ },
10
+ }
11
+
12
+ export default config
@@ -1,34 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/index.ts
21
- var src_exports = {};
22
- __export(src_exports, {
23
- toDecimalPrecision: () => toDecimalPrecision
24
- });
25
- module.exports = __toCommonJS(src_exports);
26
- var toDecimalPrecision = (value, digits) => {
27
- let fixed = 0;
28
- const result = Number.parseFloat(value.toPrecision(digits));
29
- while (Number.parseFloat(result.toFixed(fixed)) !== result && fixed < 20) {
30
- fixed++;
31
- }
32
- return result.toFixed(fixed);
33
- };
34
- //# sourceMappingURL=index.cjs.map
@@ -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 = 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,2 +0,0 @@
1
- export declare const toDecimalPrecision: (value: number, digits: number) => string;
2
- //# sourceMappingURL=index.d.ts.map
@@ -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,2 +0,0 @@
1
- export declare const toDecimalPrecision: (value: number, digits: number) => string;
2
- //# sourceMappingURL=index.d.ts.map
@@ -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,2 +0,0 @@
1
- export declare const toDecimalPrecision: (value: number, digits: number) => string;
2
- //# sourceMappingURL=index.d.ts.map
@@ -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,13 +0,0 @@
1
- // src/index.ts
2
- var toDecimalPrecision = (value, digits) => {
3
- let fixed = 0;
4
- const result = Number.parseFloat(value.toPrecision(digits));
5
- while (Number.parseFloat(result.toFixed(fixed)) !== result && fixed < 20) {
6
- fixed++;
7
- }
8
- return result.toFixed(fixed);
9
- };
10
- export {
11
- toDecimalPrecision
12
- };
13
- //# sourceMappingURL=index.mjs.map
@@ -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 = 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":[]}
@@ -1,34 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/index.ts
21
- var src_exports = {};
22
- __export(src_exports, {
23
- toDecimalPrecision: () => toDecimalPrecision
24
- });
25
- module.exports = __toCommonJS(src_exports);
26
- var toDecimalPrecision = (value, digits) => {
27
- let fixed = 0;
28
- const result = Number.parseFloat(value.toPrecision(digits));
29
- while (Number.parseFloat(result.toFixed(fixed)) !== result && fixed < 20) {
30
- fixed++;
31
- }
32
- return result.toFixed(fixed);
33
- };
34
- //# sourceMappingURL=index.cjs.map
@@ -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 = 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,2 +0,0 @@
1
- export declare const toDecimalPrecision: (value: number, digits: number) => string;
2
- //# sourceMappingURL=index.d.ts.map
@@ -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,2 +0,0 @@
1
- export declare const toDecimalPrecision: (value: number, digits: number) => string;
2
- //# sourceMappingURL=index.d.ts.map
@@ -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"}
@@ -1,38 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/index.ts
21
- var src_exports = {};
22
- __export(src_exports, {
23
- toDecimalPrecision: () => toDecimalPrecision
24
- });
25
- module.exports = __toCommonJS(src_exports);
26
- var toDecimalPrecision = (value, digits) => {
27
- let fixed = 0;
28
- const result = Number.parseFloat(value.toPrecision(digits));
29
- while (Number.parseFloat(result.toFixed(fixed)) !== result && fixed < 20) {
30
- fixed++;
31
- }
32
- return result.toFixed(fixed);
33
- };
34
- // Annotate the CommonJS export names for ESM import in node:
35
- 0 && (module.exports = {
36
- toDecimalPrecision
37
- });
38
- //# sourceMappingURL=index.cjs.map
@@ -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 = 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,2 +0,0 @@
1
- export declare const toDecimalPrecision: (value: number, digits: number) => string;
2
- //# sourceMappingURL=index.d.ts.map
@@ -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,2 +0,0 @@
1
- export declare const toDecimalPrecision: (value: number, digits: number) => string;
2
- //# sourceMappingURL=index.d.ts.map
@@ -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,2 +0,0 @@
1
- export declare const toDecimalPrecision: (value: number, digits: number) => string;
2
- //# sourceMappingURL=index.d.ts.map
@@ -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,13 +0,0 @@
1
- // src/index.ts
2
- var toDecimalPrecision = (value, digits) => {
3
- let fixed = 0;
4
- const result = Number.parseFloat(value.toPrecision(digits));
5
- while (Number.parseFloat(result.toFixed(fixed)) !== result && fixed < 20) {
6
- fixed++;
7
- }
8
- return result.toFixed(fixed);
9
- };
10
- export {
11
- toDecimalPrecision
12
- };
13
- //# sourceMappingURL=index.mjs.map
@@ -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 = 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":[]}