Created
January 15, 2014 04:36
-
-
Save tracend/8430823 to your computer and use it in GitHub Desktop.
_.getParams() #underscore #mixin #cc
This file contains 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
_.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