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
Add comma
format to the arrayFormat
option
#167
Conversation
Great work @zepod ! |
Why did you have to switch to Array#reduce? |
You have to include TypeScript types for the changes too, since a TypeScript declaration file was recently added to |
@sindresorhus Using comma format, we wanted to map the multiple elements of array to a single key in the query. .. Typescript types I will deliver |
Typescript types added |
comma
arrayFormatcomma
format to the arrayFormat
option
Looks good. Thank you :) |
This pull requests adds fourth
arrayFormat
option, namedcomma
. We needed this for our project, as we needed to support arrays in query in below shape...foo=1,2,3,4,5,6,7,8
This format is mainly used to shorten URLs which include things as identifiers, where there is expected to be a lot of them.
On the way to add this feature I had to slightly reimplement
encoderForArrayFormat
to useArray.prototype.reduce
instead of previousfor .. in