unconf15 icon indicating copy to clipboard operation
unconf15 copied to clipboard

JavaScript in R

Open jeroen opened this issue 10 years ago • 2 comments

The V8 package (a fully standalone JavaScript engine in R) is pretty stable by now. If you have some JavaScript scripts or libraries that you would like to expose in R, I can help writing bindings. I am also interested to learn if you use JavaScript in R in some other way (shiny or htmlwidgets or so); perhaps we could support server side validation/preprocessing.

Simple examples: viz.js or sql.js or cheerio. Also try the js package, which implements bindings to uglify-js and jshint:

devtools::install_github("jeroenooms/js")

Basic examples:

library(js)
code <- "function test(x, y){ x = x || 1; y = y || 1; return x*y;}"
cat(uglify_optimize(code))
cat(uglify_reformat(code, beautify = TRUE, indent_level = 2))
jshint(uglify_optimize(code))

jeroen avatar Feb 10 '15 21:02 jeroen