Alas, also has mis-use. You don't want to linearly parse urls, as a router! Addition was controversial because folks anticipated mis-use like this. https://news.ycombinator.com/item?id=46043318
... is _also_ available in Web Workers, or _only_ available in Web Workers?
Overall I dislike the shift away from a URL as a language-agnostic string primitive to some weird convoluted object which is limited to specific use cases.
URL literally stands for Universal Resource Locator... A string is Universal. It can be passed around easily between processes, it can be easily stored in a database, it can be easily shared online, it can be easily passed to an LLM... URLs were supported by LLMs before LLMs even existed! You've got to appreciate that!
This class they call URL is actually not a URL at all, it's more like a bound URLParser or URLExtractor.
A URL is a string that's a fact. Even ask Google; "is a URL a string?" it will say yes.
The idea of a URL instance as a language-specific construct is a bad idea. It's one of the reasons why many people don't like Java.
[EDIT] I don't dislike this API though it initially triggered my Java PTSD as I mistakenly thought it built on TOP of the URL instance. It actually takes things in the opposite direction as I initially understood; it's moving back towards URLs as string primitives which is what I advocate for. I do hope we don't end up adding too much more complexity related to URL handling though.