Proxying primitive instances return anonymous `toString()` return functions
Bug Report
Current behavior
Within the edge runtime calling Object.toString() (Function.toString.call(Object) is equivalent, see additional context) returns an anonymous function function () { [native code] }.
You can reproduce this behavior here:
import { runServer, EdgeRuntime } from 'edge-runtime'
const initialCode = `
console.log('Object:\\n');
console.log({}.__proto__.constructor.toString());
console.log(Object.toString());
console.log(Function.toString.call(Object));
console.log('\\nArray:\\n');
console.log([].__proto__.constructor.toString());
console.log(Array.toString());
console.log(Function.toString.call(Array));
`
const runtime = new EdgeRuntime({ initialCode });
const server = await runServer({ runtime });
server.close();
Returns:
Object:
function Object() { [native code] }
function () { [native code] }
function () { [native code] }
Array:
function Array() { [native code] }
function () { [native code] }
function () { [native code] }
Expected behavior/code
In both browser and node runtimes, using Function.toString.call(Object) returns function Object() { [native code] }. I have a feeling like it should work in a edge runtime as well 🤔
Possible solution
I nailed it down to this proxy and similarly for jest.setup.ts however, I couldn't figure out a solution for it 😞
Additional context/screenshots
For background context, I found this using the airtable lib, which was using lodash's isPlainObject function, specifically this line: https://github.com/lodash/lodash/blob/4.17.15/lodash.js#L12046 (directly objectCtorString). I've been debating whether that is unreliable to use on lodash's library or something broken by the runtime. I have a feeling like this is something the runtime should fix since it works as expected on node/browser runtimes but let me know otherwise.