Skip to content

Instantly share code, notes, and snippets.

@allenfantasy
Created June 6, 2018 11:30
Show Gist options
  • Save allenfantasy/dc29a6d45ea33139e9a5c0f3f23db0ae to your computer and use it in GitHub Desktop.
Save allenfantasy/dc29a6d45ea33139e9a5c0f3f23db0ae to your computer and use it in GitHub Desktop.
getQueryStringObject
const getQueryStringObject = url => {
let query = url.split('?')
if (query.length > 1) {
let params = query[1].split('&')
let values = {}
for (let i = 0; i < params.length; i++) {
let param = params[i].split('=')
values[param[0]] = param[1]
}
return values
} else {
return {}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment