@ubeswap/token-math
Advanced tools
Comparing version 4.4.3 to 4.4.4
@@ -170,3 +170,7 @@ "use strict"; | ||
} | ||
return jsbi_1.default.toNumber(this.numerator) / jsbi_1.default.toNumber(this.denominator); | ||
const result = jsbi_1.default.toNumber(this.numerator) / jsbi_1.default.toNumber(this.denominator); | ||
if (!Number.isNaN(result)) { | ||
return result; | ||
} | ||
return parseFloat(this.toFixed(10)); | ||
} | ||
@@ -173,0 +177,0 @@ /** |
@@ -22,2 +22,5 @@ "use strict"; | ||
const makeDecimalMultiplier = (decimals) => { | ||
if (decimals <= 18) { | ||
return jsbi_1.default.BigInt(Math.pow(10, decimals)); | ||
} | ||
return jsbi_1.default.exponentiate(constants_1.TEN, jsbi_1.default.BigInt(decimals)); | ||
@@ -24,0 +27,0 @@ }; |
@@ -166,3 +166,7 @@ import _Big from "big.js"; | ||
} | ||
return JSBI.toNumber(this.numerator) / JSBI.toNumber(this.denominator); | ||
const result = JSBI.toNumber(this.numerator) / JSBI.toNumber(this.denominator); | ||
if (!Number.isNaN(result)) { | ||
return result; | ||
} | ||
return parseFloat(this.toFixed(10)); | ||
} | ||
@@ -169,0 +173,0 @@ /** |
@@ -17,4 +17,7 @@ import BN from "bn.js"; | ||
export const makeDecimalMultiplier = (decimals) => { | ||
if (decimals <= 18) { | ||
return JSBI.BigInt(Math.pow(10, decimals)); | ||
} | ||
return JSBI.exponentiate(TEN, JSBI.BigInt(decimals)); | ||
}; | ||
//# sourceMappingURL=utils.js.map |
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "4.4.3", | ||
"version": "4.4.4", | ||
"description": "⚒️ A library for token math.", | ||
@@ -8,0 +8,0 @@ "website": "https://ubeswap.org", |
@@ -270,3 +270,8 @@ import _Big, { RoundingMode } from "big.js"; | ||
} | ||
return JSBI.toNumber(this.numerator) / JSBI.toNumber(this.denominator); | ||
const result = | ||
JSBI.toNumber(this.numerator) / JSBI.toNumber(this.denominator); | ||
if (!Number.isNaN(result)) { | ||
return result; | ||
} | ||
return parseFloat(this.toFixed(10)); | ||
} | ||
@@ -273,0 +278,0 @@ |
@@ -25,3 +25,6 @@ import BN from "bn.js"; | ||
export const makeDecimalMultiplier = (decimals: number): JSBI => { | ||
if (decimals <= 18) { | ||
return JSBI.BigInt(10 ** decimals); | ||
} | ||
return JSBI.exponentiate(TEN, JSBI.BigInt(decimals)); | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
145394
2559