diff --git a/lib/browser/Bignum.js b/lib/browser/Bignum.js index 7ada158..1109855 100644 --- a/lib/browser/Bignum.js +++ b/lib/browser/Bignum.js @@ -85,28 +85,22 @@ function decorate(name) { bnjs.prototype[name] = f; }; +_bnjs.prototype.gt = function(b) { + return this.cmp(b) > 0; +}; + +_bnjs.prototype.lt = function(b) { + return this.cmp(b) < 0; +}; + decorate('add'); decorate('sub'); decorate('mul'); decorate('mod'); decorate('div'); decorate('cmp'); - -bnjs.prototype.gt = function(b) { - if (typeof b === 'string') - b = new _bnjs(b); - else if (typeof b === 'number') - b = new _bnjs(b.toString()); - return this.cmp(b) > 0; -}; - -bnjs.prototype.lt = function(b) { - if (typeof b === 'string') - b = new _bnjs(b); - else if (typeof b === 'number') - b = new _bnjs(b.toString()); - return this.cmp(b) < 0; -}; +decorate('gt'); +decorate('lt'); bnjs.prototype.toNumber = function() { return parseInt(this['toString'](10), 10);