Created
November 21, 2018 18:45
-
-
Save mLuby/b4d52e25b96fd595afe7b6d869aa2d19 to your computer and use it in GitHub Desktop.
One-liner for parsing URL query strings
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
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