Skip to content

Instantly share code, notes, and snippets.

@amatiasq
Last active August 29, 2015 14:07
Show Gist options
  • Save amatiasq/04492888dcffe0b605ed to your computer and use it in GitHub Desktop.
Save amatiasq/04492888dcffe0b605ed to your computer and use it in GitHub Desktop.
Parse URL search section ('?foo=123&bar=stuff')
function getSearch() {
return window.location.search
.substr(1) // remove the '?'
.split('&')
.map(function(entry) {
return entry
.split('=')
.map(decodeURIComponent);
});
}
function getSearch() {
return window.location.search.substr(1).split('&').map(function(a) { return a.split('=').map(decodeURIComponent) });
}
function getSearch() {
return _.object(window.location.search
.substr(1) // remove the '?'
.split('&')
.map(function(entry) {
return entry
.split('=')
.map(decodeURIComponent);
});
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment