Call Decimal.fromValue on objects that are Decimal-like
I _already_ know I'm going to update b_e.js without remembering I made this change. If you've noticed that has occurred please link me to this commit and shame me.
This commit is contained in:
parent
067ba6ce90
commit
ebf26c58e7
1 changed files with 2 additions and 2 deletions
|
@ -507,7 +507,7 @@ export default class Decimal {
|
|||
public layer: number = Number.NaN;
|
||||
|
||||
constructor(value?: DecimalSource) {
|
||||
if (value instanceof Decimal) {
|
||||
if (value instanceof Decimal || (value != null && typeof value === "object" && "sign" in value && "mag" in value && "layer" in value)) {
|
||||
this.fromDecimal(value);
|
||||
} else if (typeof value === "number") {
|
||||
this.fromNumber(value);
|
||||
|
@ -1556,7 +1556,7 @@ export default class Decimal {
|
|||
}
|
||||
|
||||
public fromValue(value: DecimalSource): Decimal {
|
||||
if (value instanceof Decimal) {
|
||||
if (value instanceof Decimal || (value != null && typeof value === "object" && "sign" in value && "mag" in value && "layer" in value)) {
|
||||
return this.fromDecimal(value);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue