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 0.14.1 to 0.14.2

25

lib/bn.js

@@ -869,3 +869,17 @@ // Utils

if (num < 0)
return this.isubn(num);
return this.isubn(-num);
// Possible sign change
if (this.sign) {
if (this.length === 1 && this.words[0] < num) {
this.words[0] = num - this.words[0];
this.sign = false;
return this;
}
this.sign = false;
this.isubn(num);
this.sign = true;
return this;
}
this.words[0] += num;

@@ -889,5 +903,12 @@

assert(typeof num === 'number');
assert(this.cmpn(num) >= 0, 'Sign change is not supported in isubn');
if (num < 0)
return this.iaddn(-num);
if (this.sign) {
this.sign = false;
this.iaddn(num);
this.sign = true;
return this;
}
this.words[0] -= num;

@@ -894,0 +915,0 @@

2

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

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

@@ -139,5 +139,5 @@ var assert = require('assert');

assert.throws(function() {
a.isubn(-200)
}, /Sign change is not supported in isubn/)
a.isubn(-200);
assert.equal(a.sign, false)
assert.equal(a.toString(), '100')
})

@@ -144,0 +144,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