Created
January 6, 2019 15:01
-
-
Save traverse/955f03956bb83d959d5e46a66efae497 to your computer and use it in GitHub Desktop.
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
const getQueryParamsFromString = (paramString: string) => ( | |
paramString ? paramString.split('&').map(splitToPair('=')) : null | |
); | |
const splitToPair = (separator: string) => (paramString: string) => { | |
const [key, value = null] = paramString.split(separator); | |
return {key, value}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment