Skip to content

Instantly share code, notes, and snippets.

@traverse
Created January 6, 2019 15:01
Show Gist options
  • Save traverse/955f03956bb83d959d5e46a66efae497 to your computer and use it in GitHub Desktop.
Save traverse/955f03956bb83d959d5e46a66efae497 to your computer and use it in GitHub Desktop.
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