Skip to content

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

@heygrady

Description

@heygrady

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions