(maybe-vector v)
tucks things into a vector, if they aren't already.
tucks things into a vector, if they aren't already.
(merge-to-vector m1 m2)
With two input maps, associate common keys into vectors and return result map containing all input data. Coerces common key values into vectors. Input maps: {:a 1 :b 2 :c 3} {:a 2 :b 4 } Example Output {:a [1 2] :b [2 4] :c 3}
With two input maps, associate common keys into vectors and return result map containing all input data. Coerces common key values into vectors. Input maps: {:a 1 :b 2 :c 3} {:a 2 :b 4 } Example Output {:a [1 2] :b [2 4] :c 3}
(nil-if-empty m)
If empty return nil. Useful for a list like this: [] to go to this: nil
If empty return nil. Useful for a list like this: [] to go to this: nil
(parse xml-map)
(parse {:keys [tag] :as xml-map}
{:keys [force-list] :or {force-list #{}} :as opt-map})
Receives clojure xml map (as provided by clojure(.data).xml) and returns json-like hash map.
opt-map
Optional second map with keys [force-list, attr-prefix,
strip-whitespace?] specify lists to be forced into vectors, what to prefix
xml attributes with, and to strip-whitespace.
Receives clojure xml map (as provided by clojure(.data).xml) and returns json-like hash map. `opt-map` Optional second map with keys [force-list, attr-prefix, strip-whitespace?] specify lists to be forced into vectors, what to prefix xml attributes with, and to strip-whitespace.
(prefix-keywords attrs-prefix hash-map)
Prefixes keywords in a map, and returns same map with prefixed arguments.
(prefix-keywords "new_" ) => {:new_a 1}
Prefixes keywords in a map, and returns same map with prefixed arguments. (prefix-keywords "new_" ) => {:new_a 1}
(xml-merge-parts {:keys [attrs content]}
{:keys [attrs-prefix strip-whitespace?]
:or {attrs-prefix "@" strip-whitespace? true}
:as opt-map})
Merges :attrs and :content to :tag of xml parsed through clojure.(data).xml. Applies post-processing via a postwalk. TODO other post-processing fn's?
Merges :attrs and :content to :tag of xml parsed through clojure.(data).xml. Applies post-processing via a postwalk. TODO other post-processing fn's?
(xml-only-text m)
If XML is only a text node return that, to be stuffed into the parent tag..
If XML is only a text node return that, to be stuffed into the parent tag..
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close