1

Is there any way to do this? Or limit execution time of eval()(e.g. not more then 1 scecond)

7
  • What about JSLint? why do you need to do such a thing? Commented Nov 13, 2012 at 9:09
  • @gdoron it seems heavy for my task. Only thing I need is to check is JS valid. I'll use it if there is no anything lite for this. Commented Nov 13, 2012 at 9:23
  • Are aware of the risks with eval? those should bother you a lot more than the execution time of it. Commented Nov 13, 2012 at 9:24
  • In my case this JS will be avaliable only for user who write it. So there is no sequrity risks Commented Nov 13, 2012 at 9:28
  • 1
    Then use JSLint... you know the options, you just need to chose. Commented Nov 13, 2012 at 9:43

1 Answer 1

1

You could try one of the minifiers, such as UglifyJS. They all include a parser which might be fairly easy to extract (UglifyJS contains a file called "parse-js.js", although I haven't looked at it in detail).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.