Closed
Description
I propose that ppl start using URLSearchParams instead of query-string.
Why?
- URLSearchParams is available in Deno, browsers and also Node. so you would be less dependent on something that is a node only feature.
- URLSearchParams follows a spec. i suppose more ppl knows how URLSearchParams works. and don't have to learn how a node specific lib works
- querystring will mix the value between string and arrays giving you an inconsistent api.
this is a footgun where you can shoot yourself if you try to parse query strings and you would expect everything to be an object and clients adds more params to the url
const obj = querystring.parse('a=a1&b=b1&b=b2') // { a: 'a1', b: ['b1', 'b2'] }
i suspect node would never have gone to implementing query-string if URLSearchParams was first implemented. There is a new trend that ppl and Node wants to follow the spec more and more, ppl wants to be able to write cross platform applications and that involves using technology that is available in all environments. some developers don't want to use module x cuz it's too dependent on Node
Metadata
Metadata
Assignees
Labels
No labels