MIRROR: javascript for 馃悳's, a tiny runtime with big ambitions
1function show(label, value) {
2 const out = JSON.stringify(value, function (key, current) {
3 if (key === '') {
4 if (typeof current === 'function') return { root: 'function' };
5 if (current === undefined) return { root: 'undefined' };
6 if (typeof current === 'symbol') return { root: 'symbol' };
7 }
8 return current;
9 });
10
11 console.log(`${label}:${out}`);
12}
13
14show('fn', function demo() {});
15show('undef', undefined);
16show('sym', Symbol.for('demo'));