I made a small example that might give you a better idea (it's not eval, but shows how to isolate a specific data processing task): https://github.com/mavdol/capsule/tree/main/examples/javascr...
And yes, you are spot on regarding LeetCode platforms. The resource limits are also designed for that kind of usage.
import { task } from "@capsule-run/sdk";
export default task({
name: "main",
compute: "HIGH",
}, async () => {
const untrustedCode = "const x = 10; x * 2 + 5;";
const result = eval(untrustedCode);
return result;
});
Hope that helps!