such.metadata
Convenience functions for working with metadata. Intended to be used with (:require [such.metadata :as meta])
.
assoc
(assoc o & kvs)
assoc
the key-value pairs onto the metadata of o
, creating a new object equal to o
but with the new metadata.
(meta/assoc o :author "Brian" :lang :en-ca)
contains?
(contains? o key)
Answer whether the metadata contains the given key. A key with a nil
value counts as being contained.
(meta/contains? o :author) => true
merge
(merge o & maps)
Merge the maps onto the metadata of o
, creating a new object equal to o
but with the merged metadata.
(meta/merge o {:author "Brian" :lang :en-ca})