Last active
January 27, 2023 14:50
-
-
Save TorbjornHoltmon/afa7e5e6c4367ef87432d293411d17b2 to your computer and use it in GitHub Desktop.
Quickly parse url in console
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 urlToTest = new URL("AddUrl"); | |
let query = {}; | |
for ([key, value] of urlToTest.searchParams) { | |
query[key] = value; | |
} | |
console.log({ | |
host: urlToTest.host, | |
query: query, | |
path: urlToTest.pathname, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment