query-string icon indicating copy to clipboard operation
query-string copied to clipboard

Support `regex` for arrayFormat

Open phuhd-0935 opened this issue 3 years ago • 3 comments

I have an issue with array params url: 1. ?categoryIds=1&categoryIds=2 => categoryIds=['1', '2'] : Right 2. ?categoryIds=1 => categoryIds='1' : Wrong => Expect: categoryIds=['1'] Could you add regex option for arrayFormat ? Or everyone have a solution for this. Big thanks to you 🙇

phuhd-0935 avatar Jun 23 '22 09:06 phuhd-0935

What would a regex format do and how would it solve your problem?

sindresorhus avatar Jun 23 '22 23:06 sindresorhus

@sindresorhus An Select/dropdown required array value (it was auto fill value from route params when reload). I can hand over 1 or 2 case by convert string to array, but with more select/dropdown, it's hard to control

phuhd-0935 avatar Jun 28 '22 14:06 phuhd-0935

I don't think regex is the proper solution for this. https://github.com/sindresorhus/query-string/issues/228#issuecomment-575197530 would be better.

sindresorhus avatar Jun 28 '22 17:06 sindresorhus