vue-qs / QueryParser
Type Alias: QueryParser()<T>
QueryParser<
T
> = (rawValue
) =>T
Defined in: types.ts:17
Function that parses a raw query string value into a typed value
Type Parameters
T
T
The expected output type
Parameters
rawValue
The raw string value from the URL query parameter, or null if the parameter is missing
string
| null
Returns
T
The parsed typed value
Example
ts
const numberParser: QueryParser<number> = (rawValue) => {
if (!rawValue) return 0;
const parsed = Number(rawValue);
return isNaN(parsed) ? 0 : parsed;
};