Skip to content

Instantly share code, notes, and snippets.

@mjg123
Created July 21, 2011 22:17
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 mjg123/1098372 to your computer and use it in GitHub Desktop.
Save mjg123/1098372 to your computer and use it in GitHub Desktop.
function to turn a clojure map into a js map in ClojureScript
(defn make-js-map
"makes a javascript map from a clojure one"
[cljmap]
(reduce #(aset %1 (name (first %2)) (second %2)) (js-obj) cljmap))
; (make-js-map {:a "Hello"}) returns "Hello", not the js-map :(
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment