js_typeof: Get the type of a JavaScript object

Description Usage Arguments Examples

View source: R/js_typeof.R

Description

JavaScript wrapper to typeof to test if a piece of JavaScript code is syntactically valid, and the type of object it evaluates to. Useful to verify that a piece of JavaScript code contains a proper function/object.

Usage

1

Arguments

text

JavaScript code

Examples

1
2
3
js_typeof("function(x){return x+1}")
js_typeof("(function() {return 'foo'})()")
js_typeof("{foo : 123, bar : true}")

Example output

[1] "function"
[1] "string"
[1] "object"

js documentation built on July 2, 2020, 2:47 a.m.