Skip to content

vue-qs v0.1.18


vue-qs / QueryCodec

Type Alias: QueryCodec<T>

QueryCodec<T> = object

Defined in: types.ts:44

A codec that combines both parse and serialize functions for a given type

Example

ts
const numberCodec: QueryCodec<number> = {
  parse: (raw) => raw ? Number(raw) : 0,
  serialize: (value) => value === 0 ? null : String(value)
};

Type Parameters

T

T

The type this codec handles

Properties

parse

parse: QueryParser<T>

Defined in: types.ts:46

Function to parse string values from URL into typed values


serialize

serialize: QuerySerializer<T>

Defined in: types.ts:48

Function to serialize typed values back to URL strings

Released under the MIT License.