@ethersproject/bignumber
Advanced tools
Comparing version 5.0.0-beta.119 to 5.0.0-beta.120
@@ -26,3 +26,3 @@ import { BytesLike } from "@ethersproject/bytes"; | ||
toString(): string; | ||
toHexString(): string; | ||
toHexString(width?: number): string; | ||
toUnsafeFloat(): number; | ||
@@ -29,0 +29,0 @@ toFormat(format: FixedFormat | string): FixedNumber; |
@@ -214,3 +214,12 @@ "use strict"; | ||
FixedNumber.prototype.toString = function () { return this._value; }; | ||
FixedNumber.prototype.toHexString = function () { return this._hex; }; | ||
FixedNumber.prototype.toHexString = function (width) { | ||
if (width == null) { | ||
return this._hex; | ||
} | ||
if (width % 8) { | ||
errors.throwArgumentError("invalid byte width", "width", width); | ||
} | ||
var hex = bignumber_1.BigNumber.from(this._hex).fromTwos(this.format.width).toTwos(width).toHexString(); | ||
return bytes_1.hexZeroPad(hex, width / 8); | ||
}; | ||
FixedNumber.prototype.toUnsafeFloat = function () { return parseFloat(this.toString()); }; | ||
@@ -217,0 +226,0 @@ FixedNumber.prototype.toFormat = function (format) { |
{ | ||
"name": "@ethersproject/bignumber", | ||
"version": "5.0.0-beta.119", | ||
"version": "5.0.0-beta.120", | ||
"description": "BigNumber library used in ethers.js.", | ||
@@ -25,3 +25,3 @@ "main": "index.js", | ||
}, | ||
"gitHead": "6627cc5ee6d61ad4da34086814da5192745163c1" | ||
"gitHead": "1775d4223f4f1c792359d28df68d29de05f94644" | ||
} |
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
28267
693