Skip to content

Commit

Permalink
Fix CRAN URL note
Browse files Browse the repository at this point in the history
  • Loading branch information
andrjohns committed Jun 7, 2024
1 parent b62feb1 commit ad1fe99
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: QuickJSR
Title: Interface for the 'QuickJS' Lightweight 'JavaScript' Engine
Version: 1.2.0.9000
Version: 1.2.2
Authors@R: c(
person(c("Andrew", "R."), "Johnson", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0001-7000-8065")),
Expand Down
5 changes: 4 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# QuickJSR 1.2.0
# QuickJSR 1.2.2
- Fix non-canonical CRAN URL in READMEE

# QuickJSR 1.2.1
- Fix installation under C++11
- Fix installation for FreeBSD
- Fix detection of atomics support under Windows and ARM64
Expand Down
10 changes: 5 additions & 5 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ knitr::opts_chunk$set(
<!-- badges: start -->
[![R-CMD-check](https://github.com/andrjohns/QuickJSR/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/andrjohns/QuickJSR/actions/workflows/R-CMD-check.yaml)
[![CRAN status](https://www.r-pkg.org/badges/version/QuickJSR)](https://CRAN.R-project.org/package=QuickJSR)
[![Downloads](https://cranlogs.r-pkg.org/badges/QuickJSR?color=blue)](https://cran.rstudio.com/package=QuickJSR)
[![Downloads](https://cranlogs.r-pkg.org/badges/QuickJSR?color=blue)](https://CRAN.R-project.org/package=QuickJSR)
[![QuickJSR status badge](https://andrjohns.r-universe.dev/badges/QuickJSR)](https://andrjohns.r-universe.dev/QuickJSR)
<!-- badges: end -->

Expand Down Expand Up @@ -66,8 +66,9 @@ Use the `$source()` method to load JavaScript code into the context:
ctx$source(code = "function add(a, b) { return a + b; }")
# Or read from a file
writeLines("function subtract(a, b) { return a - b; }", "subtract.js")
ctx$source(file = "subtract.js")
subtract_js <- tempfile(fileext = ".js")
writeLines("function subtract(a, b) { return a - b; }", subtract_js)
ctx$source(file = subtract_js)
```

Then use the `$call()` method to call a specified function with arguments:
Expand Down Expand Up @@ -108,6 +109,5 @@ env$z
QuickJSR also provides a global `R` object, which you can use to access objects and functions from various R packages:

```{r}
ctx$source(code = 'function callRFunctionFromPackage() { return R.package("base")["Sys.Date"](); }')
ctx$call("callRFunctionFromPackage")
qjs_eval('R.package("base")["Sys.Date"]()')
```
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[![R-CMD-check](https://github.com/andrjohns/QuickJSR/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/andrjohns/QuickJSR/actions/workflows/R-CMD-check.yaml)
[![CRAN
status](https://www.r-pkg.org/badges/version/QuickJSR)](https://CRAN.R-project.org/package=QuickJSR)
[![Downloads](https://cranlogs.r-pkg.org/badges/QuickJSR?color=blue)](https://cran.rstudio.com/package=QuickJSR)
[![Downloads](https://cranlogs.r-pkg.org/badges/QuickJSR?color=blue)](https://CRAN.R-project.org/package=QuickJSR)
[![QuickJSR status
badge](https://andrjohns.r-universe.dev/badges/QuickJSR)](https://andrjohns.r-universe.dev/QuickJSR)
<!-- badges: end -->
Expand Down Expand Up @@ -52,7 +52,7 @@ qjs_eval("1 + 1")

``` r
qjs_eval("Math.random()")
#> [1] 0.7978077
#> [1] 0.5193045
```

For more complex interactions, you can create a QuickJS context and
Expand All @@ -69,8 +69,9 @@ Use the `$source()` method to load JavaScript code into the context:
ctx$source(code = "function add(a, b) { return a + b; }")

# Or read from a file
writeLines("function subtract(a, b) { return a - b; }", "subtract.js")
ctx$source(file = "subtract.js")
subtract_js <- tempfile(fileext = ".js")
writeLines("function subtract(a, b) { return a - b; }", subtract_js)
ctx$source(file = subtract_js)
```

Then use the `$call()` method to call a specified function with
Expand Down Expand Up @@ -136,7 +137,6 @@ QuickJSR also provides a global `R` object, which you can use to access
objects and functions from various R packages:

``` r
ctx$source(code = 'function callRFunctionFromPackage() { return R.package("base")["Sys.Date"](); }')
ctx$call("callRFunctionFromPackage")
#> [1] "2024-06-03 03:00:00 EEST"
qjs_eval('R.package("base")["Sys.Date"]()')
#> [1] "2024-06-07 03:00:00 EEST"
```

0 comments on commit ad1fe99

Please sign in to comment.