Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
_.getParams() #underscore #mixin #cc
// parses a query string and returns the parameters in a javascript object
getParams : function(query){
var query = {};
new RegExp("([^?=&]+)(=([^&]*))?", "g"),
function($0, $1, $2, $3) { query[$1] = decodeURIComponent($3); }
return query;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment