MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / qs

Function qs

dashboard/lib/qs.ts:2–9  ·  view source on GitHub ↗
(params: Record<string, string | number | undefined>)

Source from the content-addressed store, hash-verified

1/** Build a `?key=value` query suffix, skipping undefined/empty params. */
2export function qs(params: Record<string, string | number | undefined>) {
3 const search = new URLSearchParams();
4 for (const [key, value] of Object.entries(params)) {
5 if (value !== undefined && value !== "") search.set(key, String(value));
6 }
7 const suffix = search.toString();
8 return suffix ? `?${suffix}` : "";
9}

Callers 3

api.tsFile · 0.90
api.tsFile · 0.90
lib-utils.test.mjsFile · 0.85

Calls 1

setMethod · 0.45

Tested by

no test coverage detected