Skip to content

Instantly share code, notes, and snippets.

@andreortiz82
Forked from kordano/url-param.cljs
Created January 9, 2019 16:39
Show Gist options
  • Save andreortiz82/8182307b7476894bf425849b956664a8 to your computer and use it in GitHub Desktop.
Save andreortiz82/8182307b7476894bf425849b956664a8 to your computer and use it in GitHub Desktop.
URL parameter parsing with clojurescript
(defn parse-params
"Parse URL parameters into a hashmap"
[]
(let [param-strs (-> (.-location js/window) (split #"\?") last (split #"\&"))]
(into {} (for [[k v] (map #(split % #"=") param-strs)]
[(keyword k) v]))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment