Parsing url string and returning URL object. If it's invalid url format, returning null instead of throwing Error.
Parsing string as URL has been done by `new URL(str)`. It returns an URL object or throws an Error when it's invalid. In some libraries it captures this error and returns `null` instead to make it easy to handle, it's done like below. ```js function URLparse(str) { try { return new URL(str) } catch { return null } } ``` `URL.parse()` is the standard API for covering this use-case. It returns null if the given string is invalid for URL.