Skip to content

Instantly share code, notes, and snippets.

@jtsternberg
Created April 15, 2020 15:02
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 jtsternberg/88f4386b21783b9bd1c0dbdbc73ed84b to your computer and use it in GitHub Desktop.
Save jtsternberg/88f4386b21783b9bd1c0dbdbc73ed84b to your computer and use it in GitHub Desktop.
Output query args in console
(function (qs) {
var query = (qs || window.location.search).substring(1),
bits = query ? query.split('&').map(function (params) {
var p = params.split('=')
return [ p[0], p[1] ? decodeURIComponent(p[1]) : p[1] ]
}) : [],
index = -1,
result = {},
pair
while (++index < bits.length) {
pair = bits[index]
result[pair[0]] = pair[1]
}
return result
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment