5 ms·
For Node.js, define a simple function that does minimal computation, but that would blow the stack if called say a million times[0]. Run that function inside o
by dsp1234 11y ago
For Node.js, define a simple function that does minimal computation, but that would blow the stack if called say a million times[0]. Run that function inside of a new vm context[1]. If it errors with a stack overflow, then no TCO.
[0] - function n(x){if(x > 0) n(x-1)}
[1] - https://nodejs.org/api/vm.html#vm_vm_runinnewcontext_code_sandbox_options https://nodejs.org/api/vm.html#vm_vm_runinnewcontext_code_sa...