
Research
2025 Report: Destructive Malware in Open Source Packages
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.
js-big-integer
Advanced tools
Yet another class for arbitrary-precision integers in pure JavaScript. Small. Well tested.
Yet another BigInteger class in JavaScript This library performs arithmetic operations on integers of arbitrary size.
To use it from a web browser:
<script src="BigInteger.js"></script>
To use it from the node.js:
npm install Yaffle/BigInteger
Then:
var BigInteger = require("js-big-integer").BigInteger;
The API is terrible, but small integers are stored as primitive numbers, so operations on small integers are faster. The API was updated to match the API provided by https://github.com/GoogleChromeLabs/jsbi
| Operation | BigInteger | Number | BigInt (https://github.com/tc39/proposal-bigint) |
|---|---|---|---|
| Conversion from String | BigInteger.BigInt(string) | Number(string) | BigInt(string) |
| Conversion from Number | BigInteger.BigInt(number) | N/A | BigInt(number) |
| Conversion to String | a.toString(radix) | a.toString(radix) | a.toString(radix) |
| Conversion to Number | a.toNumber() | N/A | Number(bigint) |
| Addition | BigInteger.add(a, b) | a + b | a + b |
| Subtraction | BigInteger.subtract(a, b) | a - b | a - b |
| Multiplication | BigInteger.multiply(a, b) | 0 + a * b | a * b |
| Division | BigInteger.divide(a, b) | 0 + Math.trunc(a / b) | a / b |
| Remainder | BigInteger.remainder(a, b) | 0 + a % b | a % b |
| Exponentiation | BigInteger.exponentiate(a, b) | 0 + a**b | a**b |
| Negation | BigInteger.unaryMinus(a) | 0 - a | -a |
| Comparison | BigInteger.equal(a, b) | a === b | a === b |
| ... | BigInteger.lessThan(a, b) | a < b | a < b |
| ... | BigInteger.greaterThan(a, b) | a > b | a > b |
| ... | BigInteger.notEqual(a, b) | a !== b | a !== b |
| ... | BigInteger.lessThanOrEqual(a, b) | a <= b | a <= b |
| ... | BigInteger.greaterThanOrEqual(a, b) | a >= b | a >= b |
| Signed Right Shift | BigInteger.signedRightShift(a, b) | a >> b | a >> b |
| Left Shift | BigInteger.leftShift(a, b) | a << b | a << b |
var factorial = function (n) {
var result = BigInteger.BigInt(1);
var i = 0;
while (++i <= n) {
result = BigInteger.multiply(result, BigInteger.BigInt(i));
}
return result;
};
console.log(factorial(30).toString(10));
Other pure JavaScript implementations:
FAQs
Yet another class for arbitrary-precision integers in pure JavaScript. Small. Well tested.
The npm package js-big-integer receives a total of 58 weekly downloads. As such, js-big-integer popularity was classified as not popular.
We found that js-big-integer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.

Research
/Security News
A five-month operation turned 27 npm packages into durable hosting for browser-run lures that mimic document-sharing portals and Microsoft sign-in, targeting 25 organizations across manufacturing, industrial automation, plastics, and healthcare for credential theft.