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

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

Open
bengillies opened this issue Sep 17, 2015 · 0 comments

Comments

@bengillies
Copy link

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 });

''
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

1 participant