Skip to content

Instantly share code, notes, and snippets.

@mLuby
Created November 21, 2018 18:45
Show Gist options
  • Save mLuby/b4d52e25b96fd595afe7b6d869aa2d19 to your computer and use it in GitHub Desktop.
Save mLuby/b4d52e25b96fd595afe7b6d869aa2d19 to your computer and use it in GitHub Desktop.
One-liner for parsing URL query strings
location.search.substring(1).split("&").reduce((queryObj, kv) => Object.assign(queryObj, {[decodeURIComponent(kv.split("=")[0])]: decodeURIComponent(kv.split("=")[1])}), {})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment