interpret: Interpret input string and evaluate if not-too-spicy

Description Usage Arguments Value References

View source: R/utils_interpret.R

Description

A utility to interpret calculator input

Usage

1
2
3
4
5
interpret(
  expr_str,
  max_length = 32,
  whitelist = c("/", "*", "^", "+", "-", "sqrt", "(", ")")
)

Arguments

expr_str

a character string containing an expression to evaluate

max_length

hard limit on expression string length

whitelist

list or character vector functions allowed in expr_str

Value

The return value after safely evaluating the expression

References

https://community.rstudio.com/t/secure-way-to-accept-user-input-for-shiny-apps/13554


grddavies/shinycalculator documentation built on Jan. 8, 2022, 12:07 a.m.