A library to allow merging of clojure maps using per-key merge policies.
By default, merge-keys
does a deep merge:
(merge-keys {} {:a {:c 2}} {:a {:b 1}})
=> {:a {:b 1 :c 2}}
You can override this by specifying a merge policy on a per key basis.
(merge-keys {:a :union} {:a #{1}} {:a #{2}})
=> {:a #{1 2}}
(merge-keys
{:a :concat :b :union}
{:a [1] :b #{1}}
{:a [2] :b #{2}})
=> {:a [1 2] :b #{1 2}}
To use pallet-map-merge, add the following to your :dependencies
in
project.clj
:
[pallet-map-merge "0.1.1"]
Copyright © 2012 Hugo Duncan
Distributed under the Eclipse Public License.