Skip to content

Instantly share code, notes, and snippets.

@agassan
Created August 29, 2019 22:49
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 agassan/95d67e502749a8670b9bfe7098b46991 to your computer and use it in GitHub Desktop.
Save agassan/95d67e502749a8670b9bfe7098b46991 to your computer and use it in GitHub Desktop.
var urlValue = (function(location) {
return location.search
.split(/[&||?]/)
.filter(function (x) {
return x.indexOf("=") > -1;
})
.map(function (x) {
return x.split(/=/);
})
.map(function (x) {
x[1] = x[1].replace(/\+/g, " ");
return x;
})
.reduce(function (acc, current) {
acc[current[0]] = current[1];
return acc;
}, {});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment