Skip to content

Instantly share code, notes, and snippets.

Created Jan 8, 2017
What would you like to do?
(defn- copy-nil-vals [[k v]]
(if (nil? v)
{k k}
{k v}))
(defn column-vals [column-mappings]
(->> column-mappings
(map #(select-keys % [:value :mapped_value]))
(map vals)
(map #(apply hash-map %))
(apply merge)
(map copy-nil-vals)
(apply merge)))
Copy link

AlexWheeler commented Jan 8, 2017

(column-vals [{:value "h1" :mapped_value "header1" :value "h2" :mapped_value nil}])

should return

{"h1" "header1" "h2" "h2"}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment