Skip to content

Instantly share code, notes, and snippets.

@dwest
Created July 14, 2015 03:22
Show Gist options
  • Save dwest/8f3365e3117bb12e0ddd to your computer and use it in GitHub Desktop.
Save dwest/8f3365e3117bb12e0ddd to your computer and use it in GitHub Desktop.
Convert a DOMStringMap into a Clojurescript object
(extend-type js/DOMStringMap
IEncodeClojure
(-js->clj [x options]
(let [result (atom {})]
(goog.object/forEach x
(fn [val key obj]
(when-not (re-matches #"^cljs.*" key)
(swap! result assoc (keyword key) val))))
(deref result))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment