Comparing version 4.3.0 to 4.4.0
{ | ||
"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": { |
@@ -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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
164381
4708
204