var global = Function('return this')(); 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(`
${JSON.stringify(treeify(global), null, 2)}
`);