Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
_.getParams() #underscore #mixin #cc
_.mixin({
// parses a query string and returns the parameters in a javascript object
getParams : function(query){
var query = {};
data.replace(
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