@xylabs/decimal-precision 2.11.24 → 2.12.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.
|
@@ -0,0 +1,38 @@
|
|
|
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 = parseFloat(value.toPrecision(digits));
|
|
29
|
+
while (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 +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 = 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":[]}
|
package/dist/node/index.js
CHANGED
|
@@ -1,28 +1,4 @@
|
|
|
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
1
|
// src/index.ts
|
|
21
|
-
var src_exports = {};
|
|
22
|
-
__export(src_exports, {
|
|
23
|
-
toDecimalPrecision: () => toDecimalPrecision
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(src_exports);
|
|
26
2
|
var toDecimalPrecision = (value, digits) => {
|
|
27
3
|
let fixed = 0;
|
|
28
4
|
const result = parseFloat(value.toPrecision(digits));
|
|
@@ -31,8 +7,7 @@ var toDecimalPrecision = (value, digits) => {
|
|
|
31
7
|
}
|
|
32
8
|
return result.toFixed(fixed);
|
|
33
9
|
};
|
|
34
|
-
|
|
35
|
-
0 && (module.exports = {
|
|
10
|
+
export {
|
|
36
11
|
toDecimalPrecision
|
|
37
|
-
}
|
|
12
|
+
};
|
|
38
13
|
//# sourceMappingURL=index.js.map
|
package/dist/node/index.js.map
CHANGED
|
@@ -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":"
|
|
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":[]}
|
package/package.json
CHANGED
|
@@ -12,16 +12,15 @@
|
|
|
12
12
|
},
|
|
13
13
|
"description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",
|
|
14
14
|
"docs": "dist/docs.json",
|
|
15
|
-
"types": "dist/node/index.d.ts",
|
|
16
15
|
"exports": {
|
|
17
16
|
".": {
|
|
18
17
|
"require": {
|
|
19
18
|
"types": "./dist/node/index.d.ts",
|
|
20
|
-
"default": "./dist/node/index.
|
|
19
|
+
"default": "./dist/node/index.cjs"
|
|
21
20
|
},
|
|
22
21
|
"import": {
|
|
23
22
|
"types": "./dist/node/index.d.mts",
|
|
24
|
-
"default": "./dist/node/index.
|
|
23
|
+
"default": "./dist/node/index.js"
|
|
25
24
|
}
|
|
26
25
|
},
|
|
27
26
|
"./docs": {
|
|
@@ -29,8 +28,6 @@
|
|
|
29
28
|
},
|
|
30
29
|
"./package.json": "./package.json"
|
|
31
30
|
},
|
|
32
|
-
"main": "dist/node/index.js",
|
|
33
|
-
"module": "dist/node/index.mjs",
|
|
34
31
|
"homepage": "https://xylabs.com",
|
|
35
32
|
"keywords": [
|
|
36
33
|
"xylabs",
|
|
@@ -51,5 +48,6 @@
|
|
|
51
48
|
"url": "https://github.com/xylabs/sdk-js.git"
|
|
52
49
|
},
|
|
53
50
|
"sideEffects": false,
|
|
54
|
-
"version": "2.
|
|
51
|
+
"version": "2.12.0",
|
|
52
|
+
"type": "module"
|
|
55
53
|
}
|
package/dist/node/index.mjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// src/index.ts
|
|
2
|
-
var toDecimalPrecision = (value, digits) => {
|
|
3
|
-
let fixed = 0;
|
|
4
|
-
const result = parseFloat(value.toPrecision(digits));
|
|
5
|
-
while (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
|