It's great that JavaScript now has the URLSearchParams
object to help manage query string manipulation. Unfortunately the common conventions for encoding complex data (I think
started by PHP) are not supported.
This provides a utility function to do that encoding. Might later add a similar function to do parsing. This allows you to
keep using the built-in URLSearchParams
object (which is integrated into other APIs such as
URL
), while also not being limited to simple values.
Tests used to verify correct functionality are included. See the tests for usage examples.