Skip to content

Commit

Permalink
fix: to prevent errors occuring when merging non-map value
Browse files Browse the repository at this point in the history
  • Loading branch information
itoooo committed Mar 26, 2024
1 parent 25fa1c9 commit bd5bbbd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/cljc/proton/core.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@
"Recursively merges maps."
[& maps]
(letfn [(m [& xs]
(if (some #(and (map? %) (not (record? %))) xs)
(if (every? #(and (map? %) (not (record? %))) xs)
(apply merge-with m xs)
(last xs)))]
(reduce m maps)))
4 changes: 3 additions & 1 deletion test/proton/core_test.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,6 @@
(is (= (core/deep-merge {:foo {:bar 1}} {:foo {:baz 2}})
{:foo {:bar 1 :baz 2}}))
(is (= (core/deep-merge {:foo {:bar 1}} {:baz 2})
{:foo {:bar 1} :baz 2})))
{:foo {:bar 1} :baz 2}))
(is (= (core/deep-merge {:foo 1} {:foo {:baz 2}})
{:foo {:baz 2}})))

0 comments on commit bd5bbbd

Please sign in to comment.