Creates a new URL object from a given string.
The string to parse into a URL.
Returns a new URL object.
const url = toUrl('https://example.com')console.log(url.hostname) // => 'example.com' Copy
const url = toUrl('https://example.com')console.log(url.hostname) // => 'example.com'
Will throw a TypeError if the input string is not a valid URL.
Creates a new URL object from a given string.