Skip to content

Commit d3c0faf

Browse files
committed
Replace TODO with test.todo
1 parent 24b9cb5 commit d3c0faf

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

src/lib/parse.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,13 @@ test('parseUrlSearchParams: with URLSearchParams input', (t) => {
2323
'with URLSearchParams input',
2424
)
2525
})
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')

src/lib/parse.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,10 @@ const parseFromParamSchema = (
3333
path: string[],
3434
): Record<string, unknown> | unknown => {
3535
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[]=
4136
const key = path.join('.')
4237
return parse(key, searchParams.getAll(key), node)
4338
}
4439

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-
4940
const entries = Object.entries(node).reduce<
5041
Array<[string, Record<string, unknown> | unknown]>
5142
>((acc, entry) => {

0 commit comments

Comments
 (0)