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

Fix bug #395

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Fix bug #395

wants to merge 2 commits into from

Conversation

OmarMohamedoi
Copy link

In this fix the solution handles null and empty strings properly in the stringify function when using arrayFormat:'comma'. The fix ensures that null values and empty strings are not skipped when the skipNull and skipEmptyString options are set to false. it addresses how the comma array format should properly place commas for those null and empty string values in the output.

.js
Comment on lines +1 to +19
const queryString = require('./index');

// Example data that includes null and empty strings
const params = {
list: ['item', '', null, 'last']
};

// Options to reproduce the bug
const options = {
arrayFormat: 'comma',
skipNull: false,
skipEmptyString: false
};

// Stringify the parameters with the options
const result = queryString.stringify(params, options);

// Log the result to console
console.log(result); // Expected to incorrectly skip null and empty strings based on the bug
Copy link
Contributor

Choose a reason for hiding this comment

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

This example should be in the comment of the PR or expressed via a passing unit test. This file can't be merged into main

@scottenock scottenock mentioned this pull request Dec 12, 2024
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

Successfully merging this pull request may close these issues.

2 participants