bigint-decimal 1.0.0 → 1.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.
- package/README.md +4 -0
- package/package.json +3 -3
- package/dist/common/utils.d.ts +0 -2
- package/dist/common/utils.js +0 -24
- package/dist/common/utils.js.map +0 -1
- package/dist/global/utils.d.ts +0 -2
- package/dist/global/utils.js +0 -19
- package/dist/global/utils.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# BigintDecimal
|
|
2
2
|
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
|
+
|
|
3
7
|
A blazing-fast, zero-dependency, arbitrary-precision decimal math library for TypeScript and JavaScript. Built on native `BigInt` to safely handle massive numbers, exact decimals, and eliminate floating-point errors.
|
|
4
8
|
|
|
5
9
|
Perfect for financial applications, trading platforms, and anywhere precise calculation is critical.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bigint-decimal",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "A zero-dependency, arbitrary-precision decimal math library using native BigInt for safe financial and crypto calculations.",
|
|
5
5
|
"main": "./dist/global/index.js",
|
|
6
6
|
"author": "soso tsertsvadze",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"scripts": {
|
|
9
9
|
"test": "jest",
|
|
10
10
|
"dev": "tsc -w --project tsconfig.common.json & tsc -w --project tsconfig.global.json & node --watch --watch-preserve-output ./dist/common/index.js & wait",
|
|
11
|
-
"build": "tsc --project tsconfig.
|
|
11
|
+
"build": "tsc --project tsconfig.common.json && tsc --project tsconfig.global.json"
|
|
12
12
|
},
|
|
13
13
|
"publishConfig": {
|
|
14
14
|
"access": "public",
|
|
@@ -41,4 +41,4 @@
|
|
|
41
41
|
"jest": "^30.3.0",
|
|
42
42
|
"ts-jest": "^29.4.6"
|
|
43
43
|
}
|
|
44
|
-
}
|
|
44
|
+
}
|
package/dist/common/utils.d.ts
DELETED
package/dist/common/utils.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createNumberPermutations = exports.createBigintPermutations = void 0;
|
|
4
|
-
const factorial = (n) => {
|
|
5
|
-
let result = 1n;
|
|
6
|
-
for (let i = 1n; i <= n; i++) {
|
|
7
|
-
result *= i;
|
|
8
|
-
}
|
|
9
|
-
return result;
|
|
10
|
-
};
|
|
11
|
-
const permutationsBigint = (n, r) => factorial(n) / factorial(n - r);
|
|
12
|
-
const createBigintPermutations = (size, momentumSize) => {
|
|
13
|
-
const permutations = [];
|
|
14
|
-
for (let i = 0n; i < momentumSize; i++) {
|
|
15
|
-
permutations.push(permutationsBigint(size - i - 1n, momentumSize - i - 1n));
|
|
16
|
-
}
|
|
17
|
-
return permutations;
|
|
18
|
-
};
|
|
19
|
-
exports.createBigintPermutations = createBigintPermutations;
|
|
20
|
-
const createNumberPermutations = (size, momentumSize) => {
|
|
21
|
-
return (0, exports.createBigintPermutations)(BigInt(size), BigInt(momentumSize)).map(Number);
|
|
22
|
-
};
|
|
23
|
-
exports.createNumberPermutations = createNumberPermutations;
|
|
24
|
-
//# sourceMappingURL=utils.js.map
|
package/dist/common/utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../utils.ts"],"names":[],"mappings":";;;AAAA,MAAM,SAAS,GAAG,CAAC,CAAS,EAAU,EAAE;IACpC,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3B,MAAM,IAAI,CAAC,CAAC;IAChB,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,CAAC,CAAS,EAAE,CAAS,EAAE,EAAE,CAChD,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AAG7B,MAAM,wBAAwB,GAAG,CAAC,IAAY,EAAE,YAAoB,EAAE,EAAE;IAC3E,MAAM,YAAY,GAAa,EAAE,CAAC;IAClC,KAAK,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,YAAY,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,YAAY,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,GAAG,CAAC,GAAG,EAAE,EAAE,YAAY,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAA;IAC/E,CAAC;IACD,OAAO,YAAY,CAAA;AACvB,CAAC,CAAA;AANY,QAAA,wBAAwB,4BAMpC;AAEM,MAAM,wBAAwB,GAAG,CAAC,IAAY,EAAE,YAAoB,EAAE,EAAE;IAC3E,OAAO,IAAA,gCAAwB,EAAC,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;AACnF,CAAC,CAAA;AAFY,QAAA,wBAAwB,4BAEpC"}
|
package/dist/global/utils.d.ts
DELETED
package/dist/global/utils.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
const factorial = (n) => {
|
|
2
|
-
let result = 1n;
|
|
3
|
-
for (let i = 1n; i <= n; i++) {
|
|
4
|
-
result *= i;
|
|
5
|
-
}
|
|
6
|
-
return result;
|
|
7
|
-
};
|
|
8
|
-
const permutationsBigint = (n, r) => factorial(n) / factorial(n - r);
|
|
9
|
-
export const createBigintPermutations = (size, momentumSize) => {
|
|
10
|
-
const permutations = [];
|
|
11
|
-
for (let i = 0n; i < momentumSize; i++) {
|
|
12
|
-
permutations.push(permutationsBigint(size - i - 1n, momentumSize - i - 1n));
|
|
13
|
-
}
|
|
14
|
-
return permutations;
|
|
15
|
-
};
|
|
16
|
-
export const createNumberPermutations = (size, momentumSize) => {
|
|
17
|
-
return createBigintPermutations(BigInt(size), BigInt(momentumSize)).map(Number);
|
|
18
|
-
};
|
|
19
|
-
//# sourceMappingURL=utils.js.map
|
package/dist/global/utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../utils.ts"],"names":[],"mappings":"AAAA,MAAM,SAAS,GAAG,CAAC,CAAS,EAAU,EAAE;IACpC,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3B,MAAM,IAAI,CAAC,CAAC;IAChB,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,CAAC,CAAS,EAAE,CAAS,EAAE,EAAE,CAChD,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AAGpC,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,IAAY,EAAE,YAAoB,EAAE,EAAE;IAC3E,MAAM,YAAY,GAAa,EAAE,CAAC;IAClC,KAAK,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,YAAY,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,YAAY,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,GAAG,CAAC,GAAG,EAAE,EAAE,YAAY,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAA;IAC/E,CAAC;IACD,OAAO,YAAY,CAAA;AACvB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,IAAY,EAAE,YAAoB,EAAE,EAAE;IAC3E,OAAO,wBAAwB,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;AACnF,CAAC,CAAA"}
|