Re: [whatwg/url] Implement URL.from helper (#443)

@annevk input validation is an open question, but please note that input is not as complicated as I see in the #354. I would like to get focus on performance leaving most of the validation for the users. You should  *know* what you put there (also make writing 3rd party libraries easier). I'd like to do things like:

```js
const input = {}
// ...
input.protocol = 'https'
// ...
input.host = 'localhost'
// ...
input.query = querystring.stringify({ a: 1, b: 2 })
// ...
input.path = ['a', 'b']
// ...
input.path.pop()
// ...
const myURL = URL.from(input)
```

If you did mistake you should get punished - sure. But what to do with users that are using typescript and checking things before using them in libraries? Punish them with double checks hurting performance?

Anyway, if we can agree on the matter I am fine with strict checks (maybe with an option for `unsafe` for those who know what they are doing?).

I'd love to see it in Node.js.

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

Received on Wednesday, 3 July 2019 08:13:01 UTC