Skip to content

Instantly share code, notes, and snippets.

@cvan
Created January 22, 2014 07:02
Show Gist options
  • Save cvan/8554591 to your computer and use it in GitHub Desktop.
Save cvan/8554591 to your computer and use it in GitHub Desktop.
function parseQueryString(qs) {
if (!qs) {
return {};
}
var chunks;
var result = [];
qs.split('&').forEach(function(val) {
chunks = val.split('=');
result.push({
name: chunks[0],
value: decodeURIComponent(chunks[1] || '')
});
});
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment