Created
July 20, 2018 19:17
-
-
Save mLuby/6bac7d00d2e45210e1873e35c103fd32 to your computer and use it in GitHub Desktop.
one-liner to parse query string into key-values.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.location.search.slice(1).match(/([^=&;]+)[=;]([^?=&;]*)/g).reduce((obj,kv)=>(obj[kv.split("=")[0].slice(1)]=kv.split("=")[1],obj),{}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment