File tree Expand file tree Collapse file tree 2 files changed +10
-9
lines changed Expand file tree Collapse file tree 2 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -23,3 +23,13 @@ test('parseUrlSearchParams: with URLSearchParams input', (t) => {
23
23
'with URLSearchParams input' ,
24
24
)
25
25
} )
26
+
27
+ test . todo ( 'parse repeated array params like foo=bar&foo=baz' )
28
+ test . todo ( 'parse bracket array params like foo[]=bar&foo[]=baz' )
29
+ test . todo ( 'parse comma array params like foo=bar,baz' )
30
+
31
+ test . todo ( 'cannot parse mixed array params like foo=bar,baz&foo=bar&foo[]=baz' )
32
+
33
+ // e.g., foo.bar= would conflict with foo.bar.a= or foo.bar.b=2
34
+ // since this would be a null object containing values (null is still a value).
35
+ test . todo ( 'cannot parse conflicting object keys' )
Original file line number Diff line number Diff line change @@ -33,19 +33,10 @@ const parseFromParamSchema = (
33
33
path : string [ ] ,
34
34
) : Record < string , unknown > | unknown => {
35
35
if ( typeof node === 'string' ) {
36
- // TODO: For array parsing, try to lookup foo=, then foo[]= patterns,
37
- // if only one match, try to detect commas, otherwise ignore commas.
38
- // if both foo= and foo[]= this is a parse error
39
- // more generally, try to find a matching key for this node in the searchParams
40
- // and throw if conflicting keys are found, e.g, both foo= and foo[]=
41
36
const key = path . join ( '.' )
42
37
return parse ( key , searchParams . getAll ( key ) , node )
43
38
}
44
39
45
- // TODO: Ensure that there are no conflicting object keys, e.g.,
46
- // foo.bar= would conflict with foo.bar.a= or foo.bar.b=2
47
- // since this would be a null object containing values (null is still a value).
48
-
49
40
const entries = Object . entries ( node ) . reduce <
50
41
Array < [ string , Record < string , unknown > | unknown ] >
51
42
> ( ( acc , entry ) => {
You can’t perform that action at this time.
0 commit comments