February 17, 2015
js_typeof function simply calls the
typeof operator on the given code. If the code is syntactically invalid, a SyntaxError will be raised.
Same for objects:
js_validate_script function can be used to validate an entire script.
To validate individual functions or objects, use the
Uglify: reformatting and optimization
The more impressive part of uglify-js is the compressor which refactors the entire syntax tree, effectively rewriting your code into a more compact but equivalent program. The
uglify_optimize function in R is a simple wrapper which parses code and then feeds it to the compressor.
You can pass compressor options to
uglify_optimize to control the various uglify optimization techniques.
JSHint: code analysis
jshint function is R will return a data frame where each row is a problem detected by the library (type, line and reason of error):
JSHint has many configuration options to control which types of code propblems it will report on.