I'm trying to find an alternative within a running script for a straight eval(externalSourceCodeInputStreamReader) that will let me check whether the external source code is valid JavaScript before I eval() it.

I'm sure some of you JavaScript gurus have plenty of ideas.

Note: it would be nice if there were more explanations of alternatives under the "Don't use eval!" section on this page...
https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Functions/eval#Don%27t_use_eval!

That page says "There are safe alternatives to eval() for common use-cases", and I'm interested in what they are.

I'd like to be able to input the code from external sites (which I have no control over) and be able to tell what is wrong with them when they won't eval() correctly.

Anyone have some nice hints?

Thanks,
Daniel Gibby





_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to