Documentation
    Preparing search index...

    Configuration options for query string parsing and stringification

    type QSParserConfig = {
        parse: {
            depth: number;
            parameterLimit: number;
            allowSparse: boolean;
            arrayLimit: number;
            comma: boolean;
        };
        stringify: {
            encode: boolean;
            encodeValuesOnly: boolean;
            arrayFormat: "indices"
            | "brackets"
            | "repeat"
            | "comma";
            skipNulls: boolean;
        };
    }
    Index

    Properties

    Properties

    parse: {
        depth: number;
        parameterLimit: number;
        allowSparse: boolean;
        arrayLimit: number;
        comma: boolean;
    }

    Configuration options for parsing query strings

    Type Declaration

    • depth: number

      Nesting depth till the parameters should be parsed.

      Defaults to 5

    • parameterLimit: number

      Number of parameters to parse.

      Defaults to 1000

    • allowSparse: boolean

      Allow sparse elements in an array.

      Defaults to false

    • arrayLimit: number

      The max limimit for the array indices. After the given limit the array indices will be converted to an object, where the index is the key.

      Defaults to 20

    • comma: boolean

      Join comma seperated query string values to an array

      Defaults to false

    stringify: {
        encode: boolean;
        encodeValuesOnly: boolean;
        arrayFormat: "indices" | "brackets" | "repeat" | "comma";
        skipNulls: boolean;
    }

    Configuration options for stringifying query objects

    Type Declaration

    • encode: boolean

      URI encode the stringified query string

      Defaults to true

    • encodeValuesOnly: boolean

      URI encode but only the values and not the keys

      Defaults to false

    • arrayFormat: "indices" | "brackets" | "repeat" | "comma"

      Define the format in which arrays should be serialized.

      • indices: a[0]=b&a[1]=c
      • brackets: a[]=b&a[]=c
      • repeat: a=b&a=c
      • comma: a=b,c

      Defaults to "indices"

    • skipNulls: boolean

      Whether or not to skip null values when serializing. When set to false, the null values will be treated as an empty string.

      Defaults to: false