From ebf26c58e71804b1e94c632f5d44ad736236ef7d Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Sun, 20 Feb 2022 16:01:27 -0600 Subject: [PATCH] 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. --- src/lib/break_eternity.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/break_eternity.ts b/src/lib/break_eternity.ts index 96917b0..55c0a9c 100644 --- a/src/lib/break_eternity.ts +++ b/src/lib/break_eternity.ts @@ -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); }