MCPcopy
hub / github.com/OneUptime/oneuptime / formatSingleObject

Function formatSingleObject

CLI/Core/OutputFormatter.ts:104–117  ·  view source on GitHub ↗
(obj: JSONObject)

Source from the content-addressed store, hash-verified

102}
103
104function formatSingleObject(obj: JSONObject): string {
105 const useColor: boolean = !isColorDisabled();
106
107 const table: Table.Table = new Table({
108 style: { head: [], border: [] },
109 });
110
111 for (const [key, value] of Object.entries(obj)) {
112 const label: string = useColor ? chalk.cyan(key) : key;
113 table.push({ [label]: truncateValue(value as JSONValue) });
114 }
115
116 return table.toString();
117}
118
119function truncateValue(val: JSONValue, maxLen: number = 60): string {
120 if (val === null || val === undefined) {

Callers 1

formatTableFunction · 0.85

Calls 4

isColorDisabledFunction · 0.85
truncateValueFunction · 0.85
pushMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected