Last active
September 9, 2020 05:04
-
-
Save agusputra/bab0241c41c187e79b10 to your computer and use it in GitHub Desktop.
parseQueryString
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
| export function parseQueryString() { | |
| const qs = decodeURIComponent(window.location.search.substring(1)).split('&'); | |
| const result = {}; | |
| for (const i in qs) { | |
| if (Object.prototype.hasOwnProperty.call(qs, i)) { | |
| const keyValue = qs[i].split('='); | |
| result[keyValue[0]] = keyValue[1]; | |
| } | |
| } | |
| return result; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment