Refactor function for style string parsing
This commit is contained in:
parent
c18714a9d8
commit
49095dcfe3
|
@ -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)) {})))
|
||||
|
||||
|
|
Loading…
Reference in New Issue