From readme:
qs will also limit specifying indices in an array to a maximum index of 20.
Any array members with an index of greater than 20
will instead be converted to an object with the index as the key
Value 20 is configurable by arrayLimit option.
First of all, arrayLimit as a name for the option is very confusing. I would expect that resulting array will contain no more than arrayLimit items and the rest items will be rejected. However, this is not correct. All values will be parsed but instead of an array I will get an object.
Ok, but what's the problem with arrayLimit. Actually it works only with array defined using bracket form:
ids[]=43750&ids[]=70936&ids[]=94691&...
If I have more than 21 ids in a query string, the resulting value will be parsed as an object:
However, if array is defined without brackets, arrayLimit will not be honoured:
ids=43750&ids=70936&ids=94691&...
If I have for example 30 ids in a query string, the resulting value will be parsed as an array:
['43750', '70936', '94691', ...]
From readme:
Value
20is configurable byarrayLimitoption.First of all,
arrayLimitas a name for the option is very confusing. I would expect that resulting array will contain no more thanarrayLimititems and the rest items will be rejected. However, this is not correct. All values will be parsed but instead of an array I will get an object.Ok, but what's the problem with
arrayLimit. Actually it works only with array defined using bracket form:If I have more than 21
idsin a query string, the resulting value will be parsed as an object:However, if array is defined without brackets,
arrayLimitwill not be honoured:If I have for example 30
idsin a query string, the resulting value will be parsed as an array: