-
Notifications
You must be signed in to change notification settings - Fork 979
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
131b574
commit 6e886c8
Showing
6 changed files
with
112 additions
and
96 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
(ns utils.map | ||
(:require [utils.money :as money])) | ||
|
||
(defn deep-compare-maps | ||
"Recursively compare two maps, using money/equal-to for bignumber values." | ||
[map1 map2] | ||
(and (= (set (keys map1)) (set (keys map2))) | ||
(every? (fn [k] | ||
(let [v1 (get map1 k) | ||
v2 (get map2 k)] | ||
(cond | ||
(and (money/bignumber? v1) (money/bignumber? v2)) (money/equal-to v1 v2) | ||
(map? v1) (deep-compare-maps v1 v2) | ||
:else (= v1 v2)))) | ||
(keys map1)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters