Created
January 3, 2017 20:23
-
-
Save dennishall1/bea527c2e981618709c50ae1c71243a7 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
// pass in either location.search or location.hash, taking care to remove the leading '?' or '#' first. | |
function getParams(str) { | |
return str.split("&").reduce(function(params, keyValuePair){ | |
keyValuePair = keyValuePair.split('='); | |
params[decodeURIComponent(keyValuePair[0])] = decodeURIComponent(keyValuePair[1]); | |
return params; | |
}, {}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment