Skip to content

Instantly share code, notes, and snippets.

@runexec
Created March 19, 2016 07:57
Show Gist options
  • Save runexec/b8963bb17e1109be4a80 to your computer and use it in GitHub Desktop.
Save runexec/b8963bb17e1109be4a80 to your computer and use it in GitHub Desktop.
(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