Open ayZagen opened 3 months ago
1.1.21+70ca2b76c
Linux 5.15.153.1-microsoft-standard-WSL2 x86_64 x86_64
const a = function() { console.log( 'test' ); }; console.log( a.constructor.toString() );
Bun Output:
function Function() { [native code] }
NodeJs & Browser Output:
The output must be the same for javascript environments. This could lead to bugs in existing projects which checks functions as value.constructor.toString() === 'function Function() { [native code] }'
value.constructor.toString() === 'function Function() { [native code] }'
Link to ES spec https://tc39.es/Function-prototype-toString-revision/#proposal-sec-function.prototype.tostring
@dszymon Can you elaborate the thumbs down?
What version of Bun is running?
1.1.21+70ca2b76c
What platform is your computer?
Linux 5.15.153.1-microsoft-standard-WSL2 x86_64 x86_64
What steps can reproduce the bug?
Bun Output:
NodeJs & Browser Output:
What is the expected behavior?
The output must be the same for javascript environments. This could lead to bugs in existing projects which checks functions as
value.constructor.toString() === 'function Function() { [native code] }'