Skip to content

Instantly share code, notes, and snippets.

@davelnewton
Created July 17, 2020 19:08
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 davelnewton/4b4b537e5771938f2a91eeabdb605f06 to your computer and use it in GitHub Desktop.
Save davelnewton/4b4b537e5771938f2a91eeabdb605f06 to your computer and use it in GitHub Desktop.
const ret = str.split('&').reduce((acc, vars) => {
const [key, val] = vars.split('=').map(decodeURIComponent)
console.log('fromURLQuery', { key, val })
acc[key] = val
return acc
}, {})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment