Re: [whatwg/url] URL.canParse() (Issue #713)

If you have the following code, the url actually needs to be parsed twice.

```js
const url = 'http://foo.com'
if (URL.canParse(url)) {
  return new URL(url)
}
```

Looking back, now that we've added `URL.parse()` to return null if it's invalid(https://github.com/whatwg/url/pull/825), why do we need `URL.canParse()`?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/url/issues/713#issuecomment-2061096040
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/url/issues/713/2061096040@github.com>

Received on Wednesday, 17 April 2024 12:01:15 UTC