MCPcopy
hub / github.com/directus/directus / addQueryToPath

Function addQueryToPath

app/src/utils/add-query-to-path.ts:8–16  ·  view source on GitHub ↗
(path: string, query: Record<string, string>)

Source from the content-addressed store, hash-verified

6 * @param query - Object style query parameters to add
7 */
8export function addQueryToPath(path: string, query: Record<string, string>): string {
9 const queryParams = new URLSearchParams(path.split('?')[1] || '');
10
11 for (const [key, value] of Object.entries(query)) {
12 queryParams.set(key, value);
13 }
14
15 return path.split('?')[0] + '?' + queryParams;
16}

Callers 3

checkForSystemFunction · 0.90
saveImageFunction · 0.90

Calls 1

setMethod · 0.65

Tested by

no test coverage detected