Refactor function for style string parsing

This commit is contained in:
Saskia Lindner 2017-09-19 22:31:25 +02:00 committed by Daniel Compton
parent c18714a9d8
commit 49095dcfe3
1 changed files with 2 additions and 1 deletions

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)) {})))