-
-
Notifications
You must be signed in to change notification settings - Fork 735
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
allowDots option for stringify. Tests also updated. #151
Conversation
I think that some array stringification test would be good to make. |
@tdzienniak -- Following three tests are enough and expected ?
|
@@ -65,9 +65,9 @@ internals.stringify = function (object, prefix, generateArrayPrefix, strictNullH | |||
} | |||
|
|||
if (Array.isArray(obj)) { | |||
values = values.concat(internals.stringify(obj[key], generateArrayPrefix(prefix, key), generateArrayPrefix, strictNullHandling, skipNulls, encode, filter)); | |||
values = values.concat(internals.stringify(obj[key], generateArrayPrefix(prefix, key), generateArrayPrefix, strictNullHandling, skipNulls, encode, filter, sort, allowDots)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks like you caught a minor bug/omission with the missing "sort" param here and below - i'm not sure if that was intentionally omitted or not originally. could you also add tests that cover the presence/absence of this parameter (here and below)?
Alternatively, if you could prepare a separate PR that adds the sort param and the tests for it, i'd prefer to merge that first and keep this PR focused on "allowDots" :-)
@ljharb - Yep, I saw 'sort' param missing as a bug due to omission. Existing tests are not capturing that bug. At depth 3 or more, without that sort does not work. input -- Without 'sort' param fix --
With sort param fix --
Committing the test for this case in same PR, hope okay. |
… keys at 3 or more depth.
Thanks, that's helpful. I'd still prefer a separate PR but I won't make it a sticking point :-) |
Lint is giving error for 3 reasons --
/github/qs/lib/stringify.js From PR perspective how do you suggest we do this so lint passes ? |
I'm fine just bumping all those limits in |
Rather than bumping up values, should I change those settings to warning ? |
Nah, warnings are pretty useless imo since they're easy to ignore. |
Cool. Done. Please pass it soon, if possible, so I can move from dependency on my branch to NPM package. Thanks ! |
[New] allowDots option for `stringify` [Fix] "sort" option should work at a depth of 3 or more
@snow01 Released as v6.1.0 |
Thanks Jordan ! |
Needs documentation added to the readme. Had to search the repo to find this to figure out this feature already existed and then view the changes to see how to use it. |
@TheSharpieOne a PR or an issue for updating the docs would be appreciated |
Added allowDots option for stringify. I have added a new test case for the same.