Created
March 19, 2016 07:57
-
-
Save runexec/b8963bb17e1109be4a80 to your computer and use it in GitHub Desktop.
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
(defn object->clj | |
"My personal utility for converting NodeJS objects. | |
Somtimes js->clj doesn't work..." | |
[object] | |
(let [props (.keys js/Object object) | |
ret (transient {})] | |
(amap props | |
idx | |
_ | |
(let [prop (aget props idx)] | |
(assoc! ret | |
(keyword prop) | |
(aget object prop)))) | |
(persistent! ret))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment