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

ParameterTypeDescription
queryParamsRecordRecord<string, string | string[] | undefined> | undefined | nullThe 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