Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle null and undefined more similarly to query-string #22

Closed
heygrady opened this issue Oct 8, 2018 · 1 comment
Closed

Handle null and undefined more similarly to query-string #22

heygrady opened this issue Oct 8, 2018 · 1 comment

Comments

@heygrady
Copy link

heygrady commented Oct 8, 2018

The way this library deals with some falsey values is different from the other competing libraries.

https://repl.it/@heygrady/querystring

Ideally:

  • ?a would parse as { a: null } (like query-string does)
  • { a: null } would stringify to a (like query-string does)
  • { a: undefined } would stringify to an empty string (like all others do)
  • FWIW, querystringify is the only one that stringifies null to "null" and undefined to "undefined"
  • query-string has a unique handling of null that enables props to not have an equals sign (which is nice for aesthetics and distinct from empty string)
  • The special cases of a=null and a=undefined will cause issues in other libraries

This library is nice because it's small. Good work!

Size Link
querystring 85B https://bundlephobia.com/result?p=querystring@0.2.0
querystringify 514B https://bundlephobia.com/result?p=querystringify@2.0.0
query-string 3kB https://bundlephobia.com/result?p=query-string@6.2.0
qs 7.3kB https://bundlephobia.com/result?p=qs@6.5.2
@3rd-Eden
Copy link
Member

I agree, and the fact that it transforms null to an actuall string "null" is a bug. Fixed all of this in querystringify@2.1.0. Thanks for the issue report <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants