Skip to content

Commit

Permalink
- ignoring nils in deep-merge
Browse files Browse the repository at this point in the history
  • Loading branch information
daslu committed Sep 10, 2024
1 parent 9a2e521 commit bda8484
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 18 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Change Log
All notable changes to this project will be documented in this file. This change log follows the conventions of [keepachangelog.com](http://keepachangelog.com/).

## [4-beta9] - 2024-09-10
- handling nils carefully in `deep-merge`
## [4-beta10] - 2024-09-10
- ignoring nils in `deep-merge`

## [4-beta9] - 2024-09-10
- making `merge-options!` and `set-options!` calls hidden in notebooks
Expand Down
14 changes: 6 additions & 8 deletions dev/scicloj/kindly/gen.clj
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,12 @@
(defn deep-merge
\"Recursively merges maps only.\"
[& xs]
(reduce (fn m [a b]
(if (and (or (nil? a)
(map? a))
(or (nil? b)
(map? b)))
(merge-with m a b)
b))
xs))
(->> xs
(remove nil?)
(reduce (fn m [a b]
(if (and (map? a) (map? b))
(merge-with m a b)
b)))))
(defn get-options
[]
Expand Down
14 changes: 6 additions & 8 deletions src/scicloj/kindly/v4/api.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@
(defn deep-merge
"Recursively merges maps only."
[& xs]
(reduce (fn m [a b]
(if (and (or (nil? a)
(map? a))
(or (nil? b)
(map? b)))
(merge-with m a b)
b))
xs))
(->> xs
(remove nil?)
(reduce (fn m [a b]
(if (and (map? a) (map? b))
(merge-with m a b)
b)))))

(defn get-options
[]
Expand Down

0 comments on commit bda8484

Please sign in to comment.