Refactor function for style string parsing

This commit is contained in:
Saskia Lindner 2017-09-19 22:31:25 +02:00
parent 7f07f3c9ef
commit 6c5de6e9f3

View File

@ -6,7 +6,8 @@
[cljs.pprint :refer [pprint]]))
(defn string->css [css-string]
(->> (map #(str/split % #":") (str/split (get css-string "style") #";"))
(->> (str/split (get css-string "style") #";")
(map #(str/split % #":"))
(reduce (fn [acc [property value]]
(assoc acc (keyword property) value)) {})))