Skip to content

Instantly share code, notes, and snippets.

@jmacqueen
Created February 20, 2019 13:21
Show Gist options
  • Save jmacqueen/0cfbf7972e3e0e261528a8958cae9691 to your computer and use it in GitHub Desktop.
Save jmacqueen/0cfbf7972e3e0e261528a8958cae9691 to your computer and use it in GitHub Desktop.
Object from the browser query
query = window.location.search
.replace('?','')
.split('&')
.reduce((obj, item) => {
const pair = item.split('=')
obj[pair[0]] = pair[1]
return obj
}, {})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment