Cory McWilliams
3edfaf9137
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4248 ed5197a5-7fde-0310-b194-c3ffbd925b24
10 lines
362 B
JavaScript
10 lines
362 B
JavaScript
function treeify(o) {
|
|
if (typeof(o) == 'object') {
|
|
return Object.fromEntries(Object.keys(o).map(x => [x, treeify(o[x])]));
|
|
} else if (typeof(o) == 'function') {
|
|
return 'function';
|
|
} else if (typeof(o) == 'string' || typeof(o) == 'number') {
|
|
return o;
|
|
}
|
|
}
|
|
app.setDocument(`<pre style="color:#fff">${JSON.stringify(treeify(globalThis), null, 2)}</pre>`); |