Skip to content

Instantly share code, notes, and snippets.

@tracend
Created January 15, 2014 04:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tracend/8430823 to your computer and use it in GitHub Desktop.
Save tracend/8430823 to your computer and use it in GitHub Desktop.
_.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