MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / prettyPrint

Function prettyPrint

src/runtime_debug.js:263–284  ·  view source on GitHub ↗
(arg)

Source from the content-addressed store, hash-verified

261var printObjectList = [];
262
263function prettyPrint(arg) {
264 if (typeof arg == 'undefined') return 'undefined';
265 if (typeof arg == 'boolean') arg = arg + 0;
266 if (!arg) return arg;
267 var index = printObjectList.indexOf(arg);
268 if (index >= 0) return `<${arg}|${index}>`;
269 if (arg.toString() == '[object HTMLImageElement]') {
270 return arg + '\n\n';
271 }
272 if (arg.byteLength) {
273 return '{' + Array.prototype.slice.call(arg, 0, Math.min(arg.length, 400)) + '}';
274 }
275 if (typeof arg == 'function') {
276 return '<function>';
277 } else if (typeof arg == 'object') {
278 printObjectList.push(arg);
279 return `<${arg}|${printObjectList.length-1}>`;
280 } else if (typeof arg == 'number') {
281 if (arg > 0) return `${ptrToString(arg)} (${arg})`;
282 }
283 return arg;
284}
285#endif

Callers 1

libdylink.jsFile · 0.85

Calls 4

ptrToStringFunction · 0.85
callMethod · 0.45
minMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected