Repository navigation
fix: match jQuery 4 output for bracketed keys, empty keys, and non-plain objects, and bump to v1.2.10 - #46
Merged
Merged
Conversation
…ects - Add array items under a key already ending in "[]" as-is instead of bracketing them again (`ids[]=1`, not `ids[][]=1`) - Serialize top-level empty-string keys (`=foo`) instead of dropping them - Decide recursion with jQuery's toType() class list, so Map, Set, typed arrays, arguments, and custom Symbol.toStringTag objects are walked key by key like in jQuery Add equivalence cases covering each of these inputs.
- Point the traditional browser example at jquery-param.min.js and close its script tag - State that the output is tested against jQuery 4.x
actions/checkout and actions/setup-node v7 run on node24. `npm test` already builds before running Vitest, so the separate build step ran the build twice.
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.
Summary
$.param():[]are added as-is ({ 'ids[]': [1, 2] }->ids[]=1&ids[]=2, previouslyids[][]=1&ids[][]=2){ '': 'foo' }->=foo, previously dropped)toType()class list, soMap,Set, typed arrays,arguments, and objects with a customSymbol.toStringTagare walked key by key instead of stringifiedfunction #9->function #10)jquery-param.min.js(and close its<script>tag), and state that the output is tested against jQuery 4.xactions/checkoutandactions/setup-nodeto v7 (node24) and drop the build step thatnpm testalready runsBehavior changes
Output changes only for inputs where it previously differed from jQuery:
{ 'ids[]': [1, 2] }ids[][]=1&ids[][]=2ids[]=1&ids[]=2{ '': 'foo' }=foo{ u: new Uint8Array([7, 8]) }u=7,8u[0]=7&u[1]=8{ m: new Map([['a', 1]]) }m=[object Map]Commits
test: fix duplicate name of the RegExp function casefix: match jQuery 4 for bracketed keys, empty keys, and non-plain objectsdocs: fix UMD script example and update tested jQuery versionci: update actions to v7 and drop redundant build stepchore: bump version to 1.2.10 and update dev dependenciesTest plan
npm testbuilds and passes all 114 test cases (99 existing + 15 new)paramin a clean context:param({ 'ids[]': [1, 2] })->ids%5B%5D=1&ids%5B%5D=2