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

Support arrays in objectToQueryString #13

Merged
merged 3 commits into from
Feb 19, 2021
Merged

Conversation

mdnsk
Copy link
Contributor

@mdnsk mdnsk commented Feb 18, 2021

Added support of arrays in passed objects.

{'foo': ['bar', 'baz']} converts to foo=bar&foo=baz.

return acc.concat(value.map((item) => `${key}=${encodeURIComponent(item)}`));
}

return acc.concat(`${key}=${encodeURIComponent(value)}`);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I decided to use Array.concat instead of spread operator to prevent adding of polyfills.

@igoradamenko igoradamenko merged commit 8689415 into master Feb 19, 2021
@igoradamenko
Copy link
Contributor

Published @funboxteam/diamonds@8.1.0. Thanks!

@igoradamenko igoradamenko deleted the array-in-query-string branch February 19, 2021 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants