MCPcopy Index your code
hub / github.com/scriptscat/scriptcat / formatValue

Function formatValue

example/tests/sandbox_test.js:45–58  ·  view source on GitHub ↗
(value)

Source from the content-addressed store, hash-verified

43 );
44
45 function formatValue(value) {
46 if (value === window) return "[sandbox window]";
47 if (value === unsafeWindow) return "[unsafeWindow]";
48 if (value === document) return "[document]";
49 if (value && value.nodeType) return `[node ${value.nodeName}]`;
50 if (typeof value === "function")
51 return `[function ${value.name || "anonymous"}]`;
52 if (typeof value === "symbol") return value.toString();
53 try {
54 return JSON.stringify(value);
55 } catch {
56 return String(value);
57 }
58 }
59
60 function assertSame(expected, actual, message) {
61 if (!Object.is(expected, actual)) {

Callers 2

assertSameFunction · 0.85
assertNotSameFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected