MCPcopy Index your code
hub / github.com/Dimillian/CodexMonitor / summarizePayload

Function summarizePayload

src/features/debug/hooks/useDebugLog.ts:6–23  ·  view source on GitHub ↗
(payload: unknown)

Source from the content-addressed store, hash-verified

4const MAX_DEBUG_ENTRIES = 200;
5
6function summarizePayload(payload: unknown): unknown {
7 if (Array.isArray(payload)) {
8 return { _type: "array", count: payload.length, sample: payload.slice(0, 5) };
9 }
10 if (payload && typeof payload === "object") {
11 const obj = payload as Record<string, unknown>;
12 const summarized: Record<string, unknown> = {};
13 for (const key of Object.keys(obj)) {
14 if (Array.isArray(obj[key])) {
15 summarized[key] = { _type: "array", count: (obj[key] as unknown[]).length };
16 } else {
17 summarized[key] = obj[key];
18 }
19 }
20 return summarized;
21 }
22 return payload;
23}
24
25export function useDebugLog() {
26 const [debugOpen, setDebugOpenState] = useState(false);

Callers 1

useDebugLogFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected