Dev Build / cleanup (push) Canceled after 0s
Dev Build / typecheck (push) Canceled after 0s
Dev Build / build (linux-arm64, ubuntu-24.04-arm, linux-arm64) (push) Canceled after 0s
Dev Build / build (linux-x64, ubuntu-latest, linux-x64) (push) Canceled after 0s
Dev Build / build (win-x64, windows-latest, win32-x64) (push) Canceled after 0s
Dev Build / dispatch-dev-docker (push) Skipped
34 lines
1.2 KiB
Plaintext
34 lines
1.2 KiB
Plaintext
/**
|
|
* Program is a reimplementation of the `qss` package:
|
|
* Copyright (c) Luke Edwards luke.edwards05@gmail.com, MIT License
|
|
* https://github.com/lukeed/qss/blob/master/license.md
|
|
*
|
|
* This reimplementation uses modern browser APIs
|
|
* (namely URLSearchParams) and TypeScript while still
|
|
* maintaining the original functionality and interface.
|
|
*
|
|
* Update: this implementation has also been mangled to
|
|
* fit exactly our use-case (single value per key in encoding).
|
|
*/
|
|
/**
|
|
* Encodes an object into a query string.
|
|
* @param obj - The object to encode into a query string.
|
|
* @param stringify - An optional custom stringify function.
|
|
* @returns The encoded query string.
|
|
* @example
|
|
* ```
|
|
* // Example input: encode({ token: 'foo', key: 'value' })
|
|
* // Expected output: "token=foo&key=value"
|
|
* ```
|
|
*/
|
|
export declare function encode(obj: Record<string, any>, stringify?: (value: any) => string): string;
|
|
/**
|
|
* Decodes a query string into an object.
|
|
* @param str - The query string to decode.
|
|
* @returns The decoded key-value pairs in an object format.
|
|
* @example
|
|
* // Example input: decode("token=foo&key=value")
|
|
* // Expected output: { "token": "foo", "key": "value" }
|
|
*/
|
|
export declare function decode(str: any): any;
|