MCPcopy Create free account
hub / github.com/cortexkit/magic-context / redactConfigValue

Function redactConfigValue

packages/pi-plugin/src/config/index.ts:135–150  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

133}
134
135function redactConfigValue(value: unknown): string {
136 if (value === undefined) return "<missing>";
137 if (value === null) return "null";
138 if (typeof value === "string") {
139 return `string, ${value.length} char${value.length === 1 ? "" : "s"}`;
140 }
141 if (typeof value === "number") return `number ${value}`;
142 if (typeof value === "boolean") return `boolean ${value}`;
143 if (Array.isArray(value))
144 return `array, ${value.length} item${value.length === 1 ? "" : "s"}`;
145 if (typeof value === "object") {
146 const keys = Object.keys(value as Record<string, unknown>);
147 return `object with keys [${keys.join(", ")}]`;
148 }
149 return typeof value;
150}
151
152function isPlainObject(value: unknown): value is Record<string, unknown> {
153 return typeof value === "object" && value !== null && !Array.isArray(value);

Callers 1

parsePiConfigFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected