Function: encodeQuery()
encodeQuery(
query?):string
Defined in: src/core/transport.ts:260
Serialise a query map: undefined / null dropped, arrays as repeated keys
(k=a&k=b), a Date as ISO-8601 UTC. Shared by every built-in transport so
the wire form is identical. A date-only API (YYYY-MM-DD, ESPN's
YYYYMMDD) wants a string: pass one rather than a Date.
Parameters
query?
Record<string, unknown>
Query map; undefined is treated as empty. Each value is a scalar, a Date
or an array of those; undefined / null (also inside an array) are dropped.
Returns
string
The &-joined key=value pairs without a leading ?; "" when nothing remains.
Keys and values use axios' component encoding (:, $, , kept; space as +).
Throws
SdvError when a value is an invalid Date ("query param "<key>" is an invalid Date").
Example
import { encodeQuery } from './core/transport.js'; // not re-exported from the package root
encodeQuery({ dates: 20240908, groups: [80, 81], limit: undefined });
// 'dates=20240908&groups=80&groups=81'