Last active
September 12, 2022 12:14
-
-
Save kordano/56a16e1b28d706557f54 to your computer and use it in GitHub Desktop.
URL parameter parsing with clojurescript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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
This function does not handle escape codes:
Here's a drop-in replacement which does: