Skip to content

Instantly share code, notes, and snippets.

@metametadata
Created November 2, 2017 10:11
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save metametadata/b67a3e7f722589e04b021d60510be504 to your computer and use it in GitHub Desktop.
Save metametadata/b67a3e7f722589e04b021d60510be504 to your computer and use it in GitHub Desktop.
ClojureScript read env in NodeJS
(defn -js->clj+
"For cases when built-in js->clj doesn't work. Source: https://stackoverflow.com/a/32583549/4839573"
[x]
(into {} (for [k (js-keys x)]
[k (aget x k)])))
(defn env
"Returns current env vars as a Clojure map."
[]
(-js->clj+ (.-env js/process)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment