GoogleChromeLabs / native-url

Node's url module implemented using the built-in URL API.
https://npm.im/native-url
Apache License 2.0
284 stars 11 forks source link

URLSearchParams usage #7

Open niksy opened 4 years ago

niksy commented 4 years ago

Do you plan on using native URLSearchParams API instead of querystring module to decode/encode query string? I see that it’s mentioned in codebase, but it’s not active since there is no Edge 16 support. Since this can also be polyfilled, maybe there is possibility to drop all 3rd party dependencies and go native all the way?

janicklas-ralph commented 4 years ago

The main reason for not using URLSearchParams is because it's not supported in Edge 16. Since Edge 16 supports type=module scripts our polyfilling technique would not work. So I'm not sure how we can polyfill URLSearchParams for all nomodule browsers + Edge 16 without doing something more complicated like reading the user-agent.

Let me know your thoughts on this and if you think theres a better way to polyfill URLSearchParams

niksy commented 4 years ago

Yeah, I understand. I think it’s then better to wait for wider URLSearchParams browser support.

Nevertheless, I liked the idea of native-url module so I went and created native-querystring, so that could work for developers who also want to polyfill URLSearchParams and use the convenience of querystring module!

Let me know if you’re interested in maybe mentioning this in your README (e.g. additional aliasing).