Created
July 14, 2015 03:22
-
-
Save dwest/8f3365e3117bb12e0ddd to your computer and use it in GitHub Desktop.
Convert a DOMStringMap into a Clojurescript object
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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