Created
July 8, 2023 07:27
-
-
Save Git-I985/30f102a9c1b9ae808e1a58dec1885c1d to your computer and use it in GitHub Desktop.
Parse query params
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 getQueryParams = (str) => Object.fromEntries(Array.from(str.matchAll(/(?:([^?=&]+)=([^=&]+))/gm)).map(([_, param, value]) => [decodeURIComponent(param), decodeURIComponent(value)])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Invalid impl, does not process # (hash) in url