-
-
Notifications
You must be signed in to change notification settings - Fork 743
Open
Description
Hi there,
I'm trying to figure out if qs.parse
allow us to update the query key value instead of collecting those as an array from the doc, but I can not find anything about that so I'm asking here.
By default,
qs.parse('?num=1&num=2') === { num: ['1', '2'] };
Instead, I just care about the last value assigned to num
in the query. i.e.
qs.parse('?num=1&num=2', { some_option: true }) === { num: '2' };
Is there a some_option
to do so?
I'm working on an API and want a consistent way to handle the value. It is annoying to check if the query value is an array for a given key every single time (and it can be an object sometimes)... and at this point I decided to ignore all other value but the latest bound to the key.
But I guess people may also want only the first key value is preserved?! (e.g. that is how StarkOverflow handled their duplicated query key.)
Thanks!
skerit, 617dev, hellomrbigshot, sammy42, alextrastero and 1 more