Last active
December 18, 2015 00:09
-
-
Save fiznool/5694730 to your computer and use it in GitHub Desktop.
Parses a query string into a JSON object.
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
var parseQueryParams = function(params) { | |
if(!params) { return {}; } | |
return _.reduce(params.split('&'), function (hash, param) { | |
var p = param.split('='); | |
hash[p[0]] = p[1]; | |
return hash; | |
}, {}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment