Last active
March 28, 2018 04:51
-
-
Save ggarek/7499dfd091651c4ae191d92b0850e1e6 to your computer and use it in GitHub Desktop.
parse query string
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
function getQueryParams() { | |
return window.location.search | |
.replace(/^\?/, '').split('&').filter(Boolean) | |
.map(function(kv) { return kv.split('='); }) | |
.reduce(function(a, next) { return (a[next[0]] = decodeURIComponent(next[1]), a); }, {}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment