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

Function toSafeString

frontend/src/utils/tsx-utils.tsx:195–206  ·  view source on GitHub ↗
(x: unknown)

Source from the content-addressed store, hash-verified

193}
194
195export function toSafeString(x: unknown): string {
196 if (typeof x === 'undefined' || x === null) {
197 return '';
198 }
199 if (typeof x === 'string') {
200 return x;
201 }
202 if (typeof x === 'boolean' || typeof x === 'number') {
203 return String(x);
204 }
205 return toJson(x);
206}
207
208export function ObjToKv(obj: Record<string, unknown>): { key: string; value: unknown }[] {
209 const ar = [] as { key: string; value: unknown }[];

Callers 3

getPreviewTagsFunction · 0.90
MessageHeadersFunction · 0.90
QuickTableFunction · 0.85

Calls 2

toJsonFunction · 0.90
StringInterface · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…