Skip to content

Instantly share code, notes, and snippets.

@fiznool
Last active December 18, 2015 00:09
Show Gist options
  • Save fiznool/5694730 to your computer and use it in GitHub Desktop.
Save fiznool/5694730 to your computer and use it in GitHub Desktop.
Parses a query string into a JSON object.
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