@furystack/rest
Version:
Generic REST package
19 lines • 855 B
TypeScript
/**
* Serializes any JSON-stringifiable value to a URL-safe base64 string
* suitable for `application/x-www-form-urlencoded`. Pipeline:
*
* 1. `JSON.stringify` (preserves type info even for primitives)
* 2. `encodeURIComponent` (UTF-8 → percent-encoded ASCII so `btoa` works)
* 3. `unescape` (drop the percent encoding before base64)
* 4. `btoa` (base64 — keeps the result short)
* 5. `encodeURIComponent` (URL-safe `=` → `%3D`)
*
* Reversed by `decode` in `deserialize-query-string.ts`.
*/
export declare const serializeValue: (value: any) => string;
/**
* Encodes an object as a query string. `undefined` values are skipped;
* every other value is run through {@link serializeValue}.
*/
export declare const serializeToQueryString: <T extends object>(queryObject: T) => string;
//# sourceMappingURL=serialize-to-query-string.d.ts.map