Created
July 22, 2018 14:37
-
-
Save wildeyes/4b984b9f6ddb31c24b43b5e39de7534c to your computer and use it in GitHub Desktop.
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 parseQuery(queryString) { | |
var query = {}; | |
var pairs = (queryString[0] === '?' ? queryString.substr(1) : queryString).split('&'); | |
for (var i = 0; i < pairs.length; i++) { | |
var pair = pairs[i].split('='); | |
query[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1] || ''); | |
} | |
return query; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment