Function getMultipleQueryParams

Returns an array of the values for the specified key in the query object. If pred specified, returns the values that meet it.


返り値は、指定した key に対応するパラメータの値の配列。 もし pred が指定されている場合は、その関数によって返り値の配列が filter される。

getMultipleQueryParams({},            "id") === []
getMultipleQueryParams({ id: "aaa" }, "id") === ["aaa"]

// with pred specified
const is_a = (s: string) => s === "a"
getMultipleQueryParams({ id: "a" }, "id", is_a) === ["a"]
getMultipleQueryParams({}, "id", is_a) === []
getMultipleQueryParams({ id: "b" }, "id", is_a) === []
getMultipleQueryParams({ id: ["b", "a"] }, "id", is_a) === ["a"]

optional. the values that fit this predicate will be returned.

  • Type Parameters

    • T extends string

    Parameters

    • query: ParsedUrlQuery
    • key: string
    • Optionalpred: ((s: string) => s is T)
        • (s): s is T
        • Parameters

          • s: string

          Returns s is T

    Returns T[]

  • Parameters

    • query: ParsedUrlQuery
    • key: string
    • Optionalpred: ((s: string) => boolean)
        • (s): boolean
        • Parameters

          • s: string

          Returns boolean

    Returns string[]