Implement a query-string parser with repeated key and nested key support.
Implement:
function parseQuery(query) {}
Parsing rules:
- Handle optional leading
? - Decode URL-encoded keys/values
- Repeated keys become arrays (
a=1&a=2) - Dot notation creates nested objects (
user.name=Sam) - Missing values default to empty string (
a => { a: '' }) - Ignore empty keys