Browse Source

BN: Remove toJSON and fromJSON methods from BN, as they are equivalent to toString and fromString

patch-2
Braydon Fuller 10 years ago
parent
commit
e4cf84519d
  1. 10
      lib/crypto/bn.js
  2. 17
      test/crypto/bn.js

10
lib/crypto/bn.js

@ -19,16 +19,6 @@ var reversebuf = function(buf) {
return buf2;
};
BN.prototype.toJSON = function() {
return this.toString();
};
BN.prototype.fromJSON = function(str) {
var bn = BN(str);
bn.copy(this);
return this;
};
BN.prototype.fromNumber = function(n) {
var bn = BN(n);
bn.copy(this);

17
test/crypto/bn.js

@ -67,23 +67,6 @@ describe('BN', function() {
});
describe('#fromJSON', function() {
it('should make BN from a string', function() {
BN().fromJSON('5').toString().should.equal('5');
});
});
describe('#toJSON', function() {
it('should make string from a BN', function() {
BN(5).toJSON().should.equal('5');
BN().fromJSON('5').toJSON().should.equal('5');
});
});
describe('#fromString', function() {
it('should make BN from a string', function() {

Loading…
Cancel
Save