Created
October 16, 2018 15:27
-
-
Save LukeChannings/fafc6773be66fd200ab4422a83e3bd97 to your computer and use it in GitHub Desktop.
queryStringToDict.js
This file contains hidden or 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
const queryStringToDict = qs => qs | |
.split('&') | |
.map(pair => pair.split('=').map(decodeURIComponent)) | |
.reduce((dict, [key, value = true]) => ({ ...dict, [key]: value }), {}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A more modern version, using newer APIs: