Updated Query Param Parsers to Handle Repeated Keys#66
Merged
jpodwys merged 6 commits intojpodwys:masterfrom Mar 14, 2020
Merged
Updated Query Param Parsers to Handle Repeated Keys#66jpodwys merged 6 commits intojpodwys:masterfrom
jpodwys merged 6 commits intojpodwys:masterfrom
Conversation
jpodwys
reviewed
Mar 12, 2020
| obj[kvString[0]] = [obj[kvString[0]], kvString[1]]; | ||
| } else { | ||
| obj[kvString[0]] = kvString[1]; | ||
| } |
Owner
There was a problem hiding this comment.
Thank you, this addition looks great! Seeing as the code added to both arrayToObj and stringToObj is identical, would you mind moving them into a separate method? Once that's in place, I'll be happy to merge.
Contributor
Author
There was a problem hiding this comment.
Here it is. I prefer the functional programming paradigm, so I'm a bit leery of extracting into a function that performs mutation by reference. But Object.assign wasn't implemented in ES5 and I doubt you'd appreciate me bloating your library w/ a polyfill or lodash.
I did write the function so it has a return value and added a warning in the declaration comments to mitigate--will that work?
Owner
|
Thank you for the PR and the edit! Published to NPM as |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There didn't seem to be a way to reliably trigger specific paths in
getHeaderOptions, and the most recent code for superagent mentions thatRequest.qsRawis deprecated, so behavioral testing didn't seem appropriate.Instead, I added a new test file to verify functionality at the unit level.
(I also continued to target ES5 for the code itself)