Skip to content
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

fix: nested repeated array syntax (#43) #44

Merged
merged 1 commit into from
Jun 25, 2024
Merged

fix: nested repeated array syntax (#43) #44

merged 1 commit into from
Jun 25, 2024

Conversation

43081j
Copy link
Owner

@43081j 43081j commented Jun 25, 2024

Fixes #42

Essentially we had two bugs 👀

Bug 1: if you have repeat syntax when using bracket-notation, but only had one key, we would not create it as a string.

For example:

parse('foo[]=1', opts); // {foo: 1} - wrong!

parse('foo[]=1&foo[]=2', opts); // {foo: [1, 2]} - right!

Bug 2: if you have repeat syntax following an index-nested member, we would not parse it correctly.

For example:

parse('foo[bar][]=1', opts); // {foo: {bar: 1}} - wrong!

// expected: {foo: {bar: [1]}}

These should both now be fixed.

Fixes #42

Essentially we had two bugs 👀

Bug 1: if you have repeat syntax when using bracket-notation, but only
had one key, we would _not_ create it as a string.

For example:

```ts
parse('foo[]=1', opts); // {foo: 1} - wrong!

parse('foo[]=1&foo[]=2', opts); // {foo: [1, 2]} - right!
```

Bug 2: if you have repeat syntax following an index-nested member, we
would not parse it correctly.

For example:

```ts
parse('foo[bar][]=1', opts); // {foo: {bar: 1}} - wrong!

// expected: {foo: {bar: [1]}}
```

These should both now be fixed.
@43081j 43081j merged commit 3546139 into v1 Jun 25, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant