@ethersproject/bignumber
Advanced tools
Comparing version 5.0.0-beta.123 to 5.0.0-beta.124
@@ -34,3 +34,4 @@ "use strict"; | ||
function BigNumber(constructorGuard, hex) { | ||
errors.checkNew(this, BigNumber); | ||
var _newTarget = this.constructor; | ||
errors.checkNew(_newTarget, BigNumber); | ||
if (constructorGuard !== _constructorGuard) { | ||
@@ -41,3 +42,2 @@ errors.throwError("cannot call consturtor directly; use BigNumber.from", errors.UNSUPPORTED_OPERATION, { | ||
} | ||
properties_1.setType(this, "BigNumber"); | ||
properties_1.defineReadOnly(this, "_hex", hex); | ||
@@ -159,3 +159,3 @@ } | ||
BigNumber.isBigNumber = function (value) { | ||
return properties_1.isType(value, "BigNumber"); | ||
return properties_1.isNamedInstance(this, value); | ||
}; | ||
@@ -162,0 +162,0 @@ return BigNumber; |
@@ -13,3 +13,3 @@ import { BytesLike } from "@ethersproject/bytes"; | ||
static from(value: any): FixedFormat; | ||
static isFixedFormat(value: any): value is FixedFormat; | ||
static isInstance(value: any): value is FixedFormat; | ||
} | ||
@@ -35,2 +35,3 @@ export declare class FixedNumber { | ||
static from(value: any, format?: FixedFormat | string): FixedNumber; | ||
static isFixedNumber(value: any): value is FixedNumber; | ||
} |
@@ -123,3 +123,2 @@ "use strict"; | ||
properties_1.defineReadOnly(this, "_multiplier", getMultiplier(decimals)); | ||
properties_1.setType(this, "FixedFormat"); | ||
} | ||
@@ -172,4 +171,4 @@ FixedFormat.from = function (value) { | ||
}; | ||
FixedFormat.isFixedFormat = function (value) { | ||
return properties_1.isType(value, "FixedFormat"); | ||
FixedFormat.isInstance = function (value) { | ||
return properties_1.isNamedInstance(this, value); | ||
}; | ||
@@ -181,3 +180,4 @@ return FixedFormat; | ||
function FixedNumber(constructorGuard, hex, value, format) { | ||
errors.checkNew(this, FixedNumber); | ||
var _newTarget = this.constructor; | ||
errors.checkNew(_newTarget, FixedNumber); | ||
properties_1.defineReadOnly(this, 'format', format); | ||
@@ -252,3 +252,3 @@ properties_1.defineReadOnly(this, '_hex', hex); | ||
// If decimals looks more like a format, and there is no format, shift the parameters | ||
if (format == null && decimals != null && (FixedFormat.isFixedFormat(decimals) || typeof (decimals) === "string")) { | ||
if (format == null && decimals != null && (FixedFormat.isInstance(decimals) || typeof (decimals) === "string")) { | ||
format = decimals; | ||
@@ -263,3 +263,3 @@ decimals = null; | ||
} | ||
var fixedFormat = (FixedFormat.isFixedFormat(format) ? format : FixedFormat.from(format)); | ||
var fixedFormat = (FixedFormat.isInstance(format) ? format : FixedFormat.from(format)); | ||
return FixedNumber.fromString(formatFixed(value, decimals), fixedFormat); | ||
@@ -271,3 +271,3 @@ }; | ||
} | ||
var fixedFormat = (FixedFormat.isFixedFormat(format) ? format : FixedFormat.from(format)); | ||
var fixedFormat = (FixedFormat.isInstance(format) ? format : FixedFormat.from(format)); | ||
var numeric = parseFixed(value, fixedFormat.decimals); | ||
@@ -292,3 +292,3 @@ if (!fixedFormat.signed && numeric.lt(Zero)) { | ||
} | ||
var fixedFormat = (FixedFormat.isFixedFormat(format) ? format : FixedFormat.from(format)); | ||
var fixedFormat = (FixedFormat.isInstance(format) ? format : FixedFormat.from(format)); | ||
if (bytes_1.arrayify(value).length > fixedFormat.width / 8) { | ||
@@ -323,4 +323,7 @@ throw new Error("overflow"); | ||
}; | ||
FixedNumber.isFixedNumber = function (value) { | ||
return properties_1.isNamedInstance(this, value); | ||
}; | ||
return FixedNumber; | ||
}()); | ||
exports.FixedNumber = FixedNumber; |
{ | ||
"name": "@ethersproject/bignumber", | ||
"version": "5.0.0-beta.123", | ||
"version": "5.0.0-beta.124", | ||
"description": "BigNumber library used in ethers.js.", | ||
@@ -25,3 +25,3 @@ "main": "index.js", | ||
}, | ||
"tarballHash": "0xc44f1d04b00cfe6b34f782630529956d529257c4162c0301e9e6426e989562ce" | ||
"tarballHash": "0xb6899a340bce872877654a774a0892a78483f3b752b20b7bed66f5a56f7a6140" | ||
} |
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
29504
12
721