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
119
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 4.3.0 to 4.4.0

5

package.json
{
"name": "bn.js",
"version": "4.3.0",
"version": "4.4.0",
"description": "Big number implementation in pure javascript",
"main": "lib/bn.js",
"scripts": {
"test": "mocha --reporter=spec test/*-test.js && jscs lib/*.js test/*.js && jshint lib/*.js"
"lint": "jscs lib/*.js test/*.js && jshint lib/*.js",
"test": "mocha --reporter=spec test/*-test.js"
},

@@ -9,0 +10,0 @@ "repository": {

1

README.md

@@ -60,2 +60,3 @@ # <img src="./logo.png" alt="bn.js" width="160" height="160" />

* `a.toString(base, padding)` - convert to base-string and pad with zeroes
* `a.toNumber()` - convert to Javascript Number (limited to 53 bits)
* `a.bitLength()` - get number of bits occupied

@@ -62,0 +63,0 @@ * `a.zeroBits()` - return number of less-significant consequent zero bits

@@ -128,2 +128,16 @@ var assert = require('assert');

describe('.toNumber()', function() {
it('should return proper Number if below the limit', function() {
var n = new BN(0x123456);
assert.deepEqual(n.toNumber(), 0x123456);
});
it('should throw when number exceeds 53 bits', function() {
var n = new BN(1).iushln(54);
assert.throws(function() {
n.toNumber();
});
});
});
describe('.zeroBits()', function() {

@@ -130,0 +144,0 @@ it('should return proper zeroBits', function() {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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