mirror of https://github.com/status-im/timbre.git
Housekeeping: rename `utils/deep-merge` -> `utils/merge-deep`
This commit is contained in:
parent
a5deb8ac2f
commit
0945b83009
|
@ -113,7 +113,7 @@
|
|||
(catch java.io.IOException _))))}}}))
|
||||
|
||||
(defn set-config! [ks val] (swap! config assoc-in ks val))
|
||||
(defn merge-config! [& maps] (apply swap! config utils/deep-merge maps))
|
||||
(defn merge-config! [& maps] (apply swap! config utils/merge-deep maps))
|
||||
(defn set-level! [level] (set-config! [:current-level] level))
|
||||
|
||||
|
||||
|
|
|
@ -25,11 +25,11 @@
|
|||
(swap! cache assoc args {:time-cached now :d-result d-result})
|
||||
@d-result))))))
|
||||
|
||||
(defn deep-merge-with ; From clojure.contrib.map-utils
|
||||
(defn merge-deep-with ; From clojure.contrib.map-utils
|
||||
"Like `merge-with` but merges maps recursively, applying the given fn
|
||||
only when there's a non-map at a particular level.
|
||||
|
||||
(deepmerge-with + {:a {:b {:c 1 :d {:x 1 :y 2}} :e 3} :f 4}
|
||||
(merge-deep-with + {:a {:b {:c 1 :d {:x 1 :y 2}} :e 3} :f 4}
|
||||
{:a {:b {:c 2 :d {:z 9} :z 3} :e 100}})
|
||||
=> {:a {:b {:z 3, :c 3, :d {:z 9, :x 1, :y 2}}, :e 103}, :f 4}"
|
||||
[f & maps]
|
||||
|
@ -40,9 +40,9 @@
|
|||
(apply f maps)))
|
||||
maps))
|
||||
|
||||
(def deep-merge (partial deep-merge-with (fn [x y] y)))
|
||||
(def merge-deep (partial merge-deep-with (fn [x y] y)))
|
||||
|
||||
(comment (deep-merge {:a {:b {:c {:d :D :e :E}}}}
|
||||
(comment (merge-deep {:a {:b {:c {:d :D :e :E}}}}
|
||||
{:a {:b {:g :G :c {:c {:f :F}}}}}))
|
||||
|
||||
(defn round-to
|
||||
|
|
Loading…
Reference in New Issue