Skip to content

array holes incorrectly copied into object on large index #5

@dougwilson

Description

@dougwilson

The following:

qs.parse('a[2]=2&a[999999999]=1')

results in the following

{ a: { '0': undefined, '1': undefined, '2': '2', '999999999': '1' } }

Since 0 and 1 were actually holes in the array (i.e. !(0 in arr)), they should not have properties created from them in the object. I would expect:

{ a: { '2': '2', '999999999': '1' } }

which is the output if you had them backwards: qs.parse('a[999999999]=1&a[2]=2')

TL;DR I think qs.parse('a[2]=2&a[999999999]=1') should have the same resulting object (with the same existing properties) as qs.parse('a[999999999]=1&a[2]=2').

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions