Skip to content

Commit

Permalink
chore: make money equal-to function a little safer
Browse files Browse the repository at this point in the history
  • Loading branch information
seanstrom committed Sep 19, 2024
1 parent 5451fc3 commit a7c0eab
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/utils/money.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@

(defn equal-to
[n1 n2]
(when-let [^js bn1 (bignumber n1)]
(try
(.eq ^js bn1 n2)
(catch :default _ false))))
(boolean
(when-let [^js bn1 (if (bignumber? n1) n1 (bignumber n1))]
(let [^js bn2 (if (bignumber? n2) n2 (bignumber n2))]
(.eq ^js bn1 bn2)))))

(extend-type BigNumber
IEquiv
Expand Down

0 comments on commit a7c0eab

Please sign in to comment.