@xylabs/decimal-precision 2.10.18 → 2.11.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.
- package/dist/index.d.mts +2 -3
- package/dist/index.d.mts.map +1 -0
- package/dist/index.d.ts +2 -3
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -38
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -14
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -9
- package/src/index.ts +0 -3
- package/tsup.config.ts +0 -16
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
declare const toDecimalPrecision: (value: number, digits: number) => string;
|
|
2
|
-
|
|
3
|
-
export { toDecimalPrecision as default, toDecimalPrecision };
|
|
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"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
declare const toDecimalPrecision: (value: number, digits: number) => string;
|
|
2
|
-
|
|
3
|
-
export { toDecimalPrecision as default, toDecimalPrecision };
|
|
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"}
|
package/dist/index.js
CHANGED
|
@@ -1,40 +1,13 @@
|
|
|
1
|
-
|
|
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);
|
|
1
|
+
'use strict';
|
|
19
2
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
var toDecimalPrecision = (value, digits) => {
|
|
28
|
-
let fixed = 0;
|
|
29
|
-
const result = parseFloat(value.toPrecision(digits));
|
|
30
|
-
while (parseFloat(result.toFixed(fixed)) !== result && fixed < 20) {
|
|
31
|
-
fixed++;
|
|
32
|
-
}
|
|
33
|
-
return result.toFixed(fixed);
|
|
3
|
+
const toDecimalPrecision = (value, digits) => {
|
|
4
|
+
let fixed = 0;
|
|
5
|
+
const result = parseFloat(value.toPrecision(digits));
|
|
6
|
+
while (parseFloat(result.toFixed(fixed)) !== result && fixed < 20) {
|
|
7
|
+
fixed++;
|
|
8
|
+
}
|
|
9
|
+
return result.toFixed(fixed);
|
|
34
10
|
};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
toDecimalPrecision
|
|
39
|
-
});
|
|
40
|
-
//# sourceMappingURL=index.js.map
|
|
11
|
+
|
|
12
|
+
exports.toDecimalPrecision = toDecimalPrecision;
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA,MAAA,kBAA+B,GAAA,CAAA,KAAA,EAAA,MAAA;;;;;;;;;;;"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return result.toFixed(fixed);
|
|
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);
|
|
9
8
|
};
|
|
10
|
-
|
|
11
|
-
export {
|
|
12
|
-
|
|
13
|
-
toDecimalPrecision
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=index.mjs.map
|
|
9
|
+
|
|
10
|
+
export { toDecimalPrecision };
|
|
11
|
+
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../src/index.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA,MAAA,kBAA+B,GAAA,CAAA,KAAA,EAAA,MAAA;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -40,10 +40,6 @@
|
|
|
40
40
|
},
|
|
41
41
|
"main": "dist/index.js",
|
|
42
42
|
"module": "dist/index.mjs",
|
|
43
|
-
"scripts": {
|
|
44
|
-
"package-compile": "tsup && publint",
|
|
45
|
-
"package-recompile": "tsup && publint"
|
|
46
|
-
},
|
|
47
43
|
"homepage": "https://xylabs.com",
|
|
48
44
|
"keywords": [
|
|
49
45
|
"xylabs",
|
|
@@ -52,10 +48,8 @@
|
|
|
52
48
|
"esm"
|
|
53
49
|
],
|
|
54
50
|
"devDependencies": {
|
|
55
|
-
"@xylabs/ts-scripts-yarn3": "^
|
|
56
|
-
"@xylabs/tsconfig": "^
|
|
57
|
-
"publint": "^0.2.2",
|
|
58
|
-
"tsup": "^7.2.0"
|
|
51
|
+
"@xylabs/ts-scripts-yarn3": "^3.0.0-rc.16",
|
|
52
|
+
"@xylabs/tsconfig": "^3.0.0-rc.16"
|
|
59
53
|
},
|
|
60
54
|
"publishConfig": {
|
|
61
55
|
"access": "public"
|
|
@@ -65,5 +59,5 @@
|
|
|
65
59
|
"url": "https://github.com/xylabs/sdk-js.git"
|
|
66
60
|
},
|
|
67
61
|
"sideEffects": false,
|
|
68
|
-
"version": "2.
|
|
62
|
+
"version": "2.11.1"
|
|
69
63
|
}
|
package/src/index.ts
CHANGED
package/tsup.config.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from 'tsup'
|
|
2
|
-
|
|
3
|
-
// eslint-disable-next-line import/no-default-export
|
|
4
|
-
export default defineConfig({
|
|
5
|
-
bundle: true,
|
|
6
|
-
cjsInterop: true,
|
|
7
|
-
clean: false,
|
|
8
|
-
dts: {
|
|
9
|
-
entry: ['src/index.ts'],
|
|
10
|
-
},
|
|
11
|
-
entry: ['src/index.ts'],
|
|
12
|
-
format: ['cjs', 'esm'],
|
|
13
|
-
sourcemap: true,
|
|
14
|
-
splitting: false,
|
|
15
|
-
tsconfig: 'tsconfig.build.json',
|
|
16
|
-
})
|