README.md

tinyjs - Lightweight Embedded JavaScript Engine (a wrapper for TinyJS)

An R interface to the 'TinyJS' — https://github.com/gfwilliams/tiny-js — JavaScript engine; a more lightweight alternative to 'V8' with no external dependencies.

The following functions are implemented:

The following data sets are included:

News

Installation

devtools::install_github("hrbrmstr/tinyjs")

Usage

library(tinyjs)

# current verison
packageVersion("tinyjs")
#> [1] '0.2.0.9000'

eval_js("var a=10;")
js_get("a")
#> [1] 10

eval_js("var b={this:'that', or:4, the:['ot', 'he', 'r']};")
js_get("b")
#> $this
#> [1] "that"
#> 
#> $or
#> [1] 4
#> 
#> $the
#> [1] "ot" "he" "r"

for(js_fil in sprintf("js/test00%d.js", 1:7)) {
  source_js(system.file(js_fil, package="tinyjs"))
  print(js_get("result"))
}
#> [1] 1
#> [1] 42
#> [1] 45
#> [1] 1
#> [1] 45
#> [1] 9
#> [1] 9

Test Results

library(tinyjs)
library(testthat)

date()
#> [1] "Tue Apr  5 17:57:07 2016"

test_dir("tests/")
#> testthat results ========================================================================================================
#> OK: 1 SKIPPED: 0 FAILED: 0

Code of Conduct

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.



hrbrmstr/tinyjs documentation built on May 17, 2019, 5:36 p.m.