Skip to content

Provide an option to ignore empty/falsy objects/arrays/values in encodeQString #2

Description

@bengillies

Currently, encoding empty/falsy objects/values as a query string results in params that represent empty versions of that data type. For example:

> juri.encodeQString({
  foo: {},
  bar: [],
  baz: '',
  qux: false
});

'foo=(:)&bar=()&baz=\'\'&qux=--'

I can can see how this might be useful in some cases, but in other cases, it's both shorter and more reasonable to just ignore them completely. Ideally, something along the following lines would be great:

> juri.encodeQString({
  foo: {},
  bar: [],
  baz: '',
  qux: false
}, { stripEmpty: true });

''

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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