Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bn.js

Package Overview
Dependencies
Maintainers
1
Versions
120
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bn.js - npm Package Compare versions

Comparing version 2.0.3 to 2.0.4

1.patch

10

lib/bn.js

@@ -64,3 +64,3 @@ (function (module, exports) {

this.length = 1;
} else {
} else if (number < 0x10000000000000) {
this.words = [

@@ -71,2 +71,10 @@ number & 0x3ffffff,

this.length = 2;
} else {
assert(number < 0x20000000000000); // 2 ^ 53 (unsafe)
this.words = [
number & 0x3ffffff,
(number / 0x4000000) & 0x3ffffff,
1
];
this.length = 3;
}

@@ -73,0 +81,0 @@ return;

2

package.json
{
"name": "bn.js",
"version": "2.0.3",
"version": "2.0.4",
"description": "Big number implementation in pure javascript",

@@ -5,0 +5,0 @@ "main": "lib/bn.js",

@@ -14,2 +14,18 @@ var assert = require('assert');

});
it('should accept 52 bits of precision', function() {
var num = Math.pow(2, 52);
assert.equal(new BN(num, 10).toString(10), num.toString(10));
});
it('should accept max safe integer', function() {
var num = Math.pow(2, 53) - 1;
assert.equal(new BN(num, 10).toString(10), num.toString(10));
});
it('should not accept an unsafe integer', function() {
var num = Math.pow(2, 53);
assert.throws(function() { new BN(num, 10); });
});
});

@@ -16,0 +32,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc