Skip to main content

getQueryParamsStringFromRecord

@h4ad/serverless-adapter > getQueryParamsStringFromRecord

(function) getQueryParamsStringFromRecord

Map query params to a string with formatted query params

Signature:

export declare function getQueryParamsStringFromRecord(queryParamsRecord: Record<string, string | string[] | undefined> | undefined | null): string;

Parameters

Parameter

Type

Description

queryParamsRecord

Record<string, string | string[] | undefined> | undefined | null

The query params record

Returns:

string

Example

const queryParams = \{ batata: undefined, petType: [ 'dog', 'fish' ] };
const result = getQueryParamsStringFromRecord(queryParams);
console.log(result);
// batata=&petType=dog&petType=fish