in src/components/TitledRow/index.tsx [53:81]
export function valueToRenderableType(
value: React.ReactNode | Record<string, unknown>,
forceFormat?: boolean,
): React.ReactChild {
if (React.isValidElement(value)) return value;
if (typeof value === 'boolean') {
return value ? 'True' : 'False';
} else if (typeof value === 'number') {
return value;
} else if (typeof value === 'string') {
try {
const val = JSON.parse(value);
if (typeof val === 'object') {
return <code>{JSON.stringify(val, null, 2)}</code>;
}
return value;
} catch {
return value;
}
}
try {
const stringified = JSON.stringify(value, null, Array.isArray(value) && !forceFormat ? undefined : 2);
return <code>{stringified}</code>;
} catch (e) {
return '';
}
}