MCPcopy Create free account
hub / github.com/vercel/vercel / formatQueryString

Function formatQueryString

packages/cli/src/util/dev/parse-query-string.ts:39–59  ·  view source on GitHub ↗
(
  query: Record<string, string[]> | undefined
)

Source from the content-addressed store, hash-verified

37 * @param query - The query object to stringify.
38 */
39export function formatQueryString(
40 query: Record<string, string[]> | undefined
41): string | null {
42 if (!query) {
43 return null;
44 }
45 let s = '';
46 let prefix = '?';
47 for (const [key, values] of Object.entries(query)) {
48 for (const value of values) {
49 s += prefix;
50 s += encodeURIComponent(key);
51 if (value !== undefined) {
52 s += '=';
53 s += encodeURIComponent(value);
54 }
55 prefix = '&';
56 }
57 }
58 return s || null;
59}

Callers 4

applyRequestTransformsFunction · 0.90
getReqUrlMethod · 0.90
DevServerClass · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected