Comparing version 0.9.3 to 0.10.0
34
index.js
@@ -50,2 +50,14 @@ try { | ||
BigNum.isBigNum = function(num) { | ||
if (!num) { | ||
return false; | ||
} | ||
for(var key in BigNum.prototype) { | ||
if (!num[key]) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
}; | ||
BigNum.prototype.inspect = function () { | ||
@@ -74,3 +86,3 @@ return '<BigNum ' + this.toString(10) + '>'; | ||
BigNum.prototype[op] = function (num) { | ||
if (num instanceof BigNum) { | ||
if (BigNum.isBigNum(num)) { | ||
return this['b'+op](num); | ||
@@ -118,3 +130,3 @@ } | ||
} | ||
else if (mod instanceof BigNum) { | ||
else if (BigNum.isBigNum(mod)) { | ||
m = mod; | ||
@@ -130,3 +142,3 @@ } | ||
} | ||
else if (num instanceof BigNum) { | ||
else if (BigNum.isBigNum(num)) { | ||
return this.bpowm(num, m); | ||
@@ -142,3 +154,3 @@ } | ||
} | ||
else if (mod instanceof BigNum) { | ||
else if (BigNum.isBigNum(mod)) { | ||
m = mod; | ||
@@ -154,3 +166,3 @@ } | ||
} | ||
else if (num instanceof BigNum) { | ||
else if (BigNum.isBigNum(num)) { | ||
return this.bmod(num, m); | ||
@@ -207,3 +219,3 @@ } | ||
BigNum.prototype.cmp = function (num) { | ||
if (num instanceof BigNum) { | ||
if (BigNum.isBigNum(num)) { | ||
return this.bcompare(num); | ||
@@ -251,3 +263,3 @@ } | ||
BigNum.prototype[name] = function (num) { | ||
if (num instanceof BigNum) { | ||
if (BigNum.isBigNum(num)) { | ||
return this['b' + name](num); | ||
@@ -267,3 +279,3 @@ } | ||
BigNum.prototype.root = function(num) { | ||
if (num instanceof BigNum) { | ||
if (BigNum.isBigNum(num)) { | ||
return this.broot(num); | ||
@@ -287,3 +299,3 @@ } | ||
else { | ||
var x = to instanceof BigNum | ||
var x = BigNum.isBigNum(to) | ||
? to.sub(this) | ||
@@ -296,3 +308,3 @@ : BigNum(to).sub(this); | ||
BigNum.prototype.invertm = function (mod) { | ||
if (mod instanceof BigNum) { | ||
if (BigNum.isBigNum(mod)) { | ||
return this.binvertm(mod); | ||
@@ -440,3 +452,3 @@ } | ||
if (num instanceof BigNum) { | ||
if (BigNum.isBigNum(num)) { | ||
return num[name].apply(num, args); | ||
@@ -443,0 +455,0 @@ } |
{ | ||
"name": "bignum", | ||
"version": "0.9.3", | ||
"version": "0.10.0", | ||
"description": "Arbitrary-precision integer arithmetic using OpenSSL", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
Sorry, the diff of this file is not supported yet
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
73900
16
1126
346