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

Skipping blank values at stringify #307

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

douglira
Copy link

No description provided.

Copy link
Owner

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm - "blank" isn't really a universal definition. Perhaps this would be better as a generic skip option? It would take a function, be passed key and value, and return true to skip. That way it could also subsume the skipNulls option (it would throw if both were passed), and then you could define your own definition for what to skip.

We'd want to add the same option to both parse and stringify.

dist/qs.js Outdated
@@ -308,6 +309,7 @@ var stringify = function stringify( // eslint-disable-line func-name-matching
prefix,
generateArrayPrefix,
strictNullHandling,
skipBlanks,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All changes made in this autogenerated file are lost; you'll need to change the files in lib instead.

@douglira
Copy link
Author

It makes sense and more suitable. I will give it a try asap

@ljharb
Copy link
Owner

ljharb commented Jul 8, 2020

@douglira have you had any time to update this PR?

@codecov
Copy link

codecov bot commented Jan 13, 2021

Codecov Report

Merging #307 (01d7117) into master (da6d249) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #307   +/-   ##
=======================================
  Coverage   99.85%   99.85%           
=======================================
  Files           8        8           
  Lines        1336     1347   +11     
  Branches      164      167    +3     
=======================================
+ Hits         1334     1345   +11     
  Misses          2        2           
Impacted Files Coverage Δ
lib/stringify.js 100.00% <100.00%> (ø)
test/stringify.js 99.73% <100.00%> (+<0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update da6d249...01d7117. Read the comment docs.

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

Successfully merging this pull request may close these issues.

None yet

2 participants