MIRROR: javascript for 馃悳's, a tiny runtime with big ambitions
1const obj = {
2 action() {
3 return 1;
4 },
5 child: {
6 inner() {
7 return 2;
8 },
9 },
10 missing: undefined,
11};
12
13const out = JSON.stringify(obj, (_key, value) => {
14 if (typeof value === 'function') return `[fn:${value.name || 'anonymous'}]`;
15 if (value === undefined) return '[undef]';
16 return value;
17});
18
19console.log(out);