MCPcopy Create free account
hub / github.com/Olanetsoft/article-idea-generator / normalizeQueryParam

Function normalizeQueryParam

pages/api/auth/callback.ts:20–26  ·  view source on GitHub ↗

* Normalize query param that could be string | string[] | undefined to a single string

(
  param: string | string[] | undefined,
)

Source from the content-addressed store, hash-verified

18 * Normalize query param that could be string | string[] | undefined to a single string
19 */
20function normalizeQueryParam(
21 param: string | string[] | undefined,
22): string | undefined {
23 if (param === undefined) return undefined;
24 if (Array.isArray(param)) return param[0];
25 return param;
26}
27
28export default async function handler(
29 req: NextApiRequest,

Callers 1

handlerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected