Skip to content

Instantly share code, notes, and snippets.

@jhickner
Created September 7, 2011 03:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jhickner/1199700 to your computer and use it in GitHub Desktop.
Save jhickner/1199700 to your computer and use it in GitHub Desktop.
recursive cljs to js
(defn ->js [o]
(cond
(map? o) (let [out (js-obj)]
(doseq [[k v] o]
(aset out (if (keyword? k) (name k) k)
(->js v)))
out)
(or (sequential? o) (set? o)) (.array (vec (map ->js o)))
:else o))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment