[#137] Add &args support to `swap-config!` (@rsslldnphy)

This commit is contained in:
Russell 2015-11-29 15:42:16 +00:00 committed by Peter Taoussanis
parent 7c3afe499b
commit e61fabf0d6
1 changed files with 3 additions and 3 deletions

View File

@ -130,9 +130,9 @@
(defmacro with-merged-config [config & body]
`(binding [*config* (enc/nested-merge *config* ~config)] ~@body))
(defn swap-config! [f]
#+cljs (set! *config* (f *config*))
#+clj (alter-var-root #'*config* f))
(defn swap-config! [f & args]
#+cljs (set! *config* (apply f *config* args))
#+clj (apply alter-var-root #'*config* f args))
(defn set-config! [m] (swap-config! (fn [_old] m)))
(defn merge-config! [m] (swap-config! (fn [old] (enc/nested-merge old m))))