Skip to content

Instantly share code, notes, and snippets.

@gormus
Forked from cvan/qs.js
Created November 14, 2018 19:10
Show Gist options
  • Save gormus/23fa4c54765dc0b763879eef67dfcf45 to your computer and use it in GitHub Desktop.
Save gormus/23fa4c54765dc0b763879eef67dfcf45 to your computer and use it in GitHub Desktop.
get query-string parameters (alternative to `URLSearchParams`)
var queryParams = window.location.search.substr(1).split('&').reduce(function (q, query) {
var chunks = query.split('=');
var key = chunks[0];
var value = chunks[1];
return (q[key] = value, q);
}, {});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment