MCPcopy
hub / github.com/redpanda-data/console / objToQuery

Function objToQuery

frontend/src/utils/query-helper.ts:50–61  ·  view source on GitHub ↗
(obj: { [key: string]: unknown })

Source from the content-addressed store, hash-verified

48 * navigate({ search: { page: 1, filter: 'active' } });
49 */
50export const objToQuery = (obj: { [key: string]: unknown }) => {
51 // '?' + queryString.stringify(obj, stringifyOptions)
52 const query = new URLSearchParams();
53 for (const [k, v] of Object.entries(obj)) {
54 if (v === null || v === undefined || v === '') {
55 continue;
56 }
57
58 query.append(k, String(v));
59 }
60 return `?${query.toString()}`;
61};
62
63/**
64 * Edit the current search query.

Callers 1

editQueryFunction · 0.85

Calls 2

toStringMethod · 0.80
StringInterface · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…