Created
May 9, 2018 08:19
-
-
Save dimorphic/b0eef2fc3532ec9ae6bb2cb1e8b82388 to your computer and use it in GitHub Desktop.
lazy man url parser
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
| let parser = document.createElement('a'); | |
| parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
| parser.protocol; // => "http:" | |
| parser.hostname; // => "example.com" | |
| parser.port; // => "3000" | |
| parser.pathname; // => "/pathname/" | |
| parser.search; // => "?search=test" | |
| parser.hash; // => "#hash" | |
| parser.host; // => "example.com:3000" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment