BN: Remove toJSON and fromJSON methods from BN, as they are equivalent to toString and fromString
This commit is contained in:
parent
002eb3dcf5
commit
e4cf84519d
@ -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);
|
||||
|
||||
@ -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…
Reference in New Issue
Block a user