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

treat underlying data as an array #95

Closed
jimmywarting opened this issue Aug 7, 2019 · 1 comment
Closed

treat underlying data as an array #95

jimmywarting opened this issue Aug 7, 2019 · 1 comment

Comments

@jimmywarting
Copy link
Owner

We treat the data as an object

{
  key1: [value1, value2, ...]
  key2: [value1, value2, ...]
}

while really it should be an array.

[
  [key1, value1],
  [key1, value2],
  [key2, value1],
  [key2, value2]
]

the order they were added should be the order they should appear in the body as well.
calling .keys() should return [key1, key1, key2, key2] not [key1, key2]

@jimmywarting
Copy link
Owner Author

const fd = new FormData()
fd.append('a', 'a1')
fd.append('b', 'b1')
fd.append('a', 'a2')
fd.append('b', 'b2')

console.log(...fd.keys()) // [a,b,a,b]
console.log(...fd.values()) // [a1,b1,a2,b2]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant