Created
October 24, 2019 17:22
-
-
Save sam-rad/abf95212d6f670d6603651b1082a04ae to your computer and use it in GitHub Desktop.
Wildcard URL parsing in node, chrome and firefox
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
// Chrome | |
new URL('https://*.bee.com'); | |
// URL { | |
// hash: "" | |
// host: "%2A.bee.com" // <= Escaped | |
// hostname: "%2A.bee.com" | |
// href: "https://%2A.bee.com/" | |
// origin: "https://%2A.bee.com" | |
// password: "" | |
// pathname: "/" | |
// port: "" | |
// protocol: "https:" | |
// search: "" | |
// searchParams: URLSearchParams {} | |
// username: "" | |
// } | |
// Firefox | |
new URL('https://*.bee.com'); | |
// TypeError: https://*.bee.com is not a valid URL | |
// Node | |
new URL('https://*.bee.com'); | |
// URL { | |
// href: 'https://*.bee.com/', | |
// origin: 'https://*.bee.com', | |
// protocol: 'https:', | |
// username: '', | |
// password: '', | |
// host: '*.bee.com', | |
// hostname: '*.bee.com', | |
// port: '', | |
// pathname: '/', | |
// search: '', | |
// searchParams: URLSearchParams {}, | |
// hash: '' | |
// } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment