MCPcopy Create free account
hub / github.com/JS-DevTools/ono / prettyPrint

Function prettyPrint

test/utils/compare-pojo.js:92–106  ·  view source on GitHub ↗

* A simplistic implementation of Node's `util.format()`

(obj, indent)

Source from the content-addressed store, hash-verified

90 * A simplistic implementation of Node's `util.format()`
91 */
92function prettyPrint (obj, indent) {
93 let json = "{\n";
94
95 // eslint-disable-next-line guard-for-in
96 for (let key in obj) {
97 json += `${indent} ${key}: ${prettyPrintValue(obj[key], indent)}\n`;
98 }
99
100 for (let sym of Object.getOwnPropertySymbols(obj)) {
101 json += `${indent} [${String(sym)}]: ${prettyPrintValue(obj[sym], indent)}\n`;
102 }
103
104 json += `${indent}}\n`;
105 return json;
106}
107
108function prettyPrintValue (value, indent) {
109 let type = typeof value;

Callers 2

comparePOJOFunction · 0.85
prettyPrintValueFunction · 0.85

Calls 1

prettyPrintValueFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…