R/cache-utils.R

Defines functions validate_key

#' @importFrom fastmap key_missing
#' @export
fastmap::key_missing

#' @importFrom fastmap is.key_missing
#' @export
fastmap::is.key_missing


validate_key <- function(key) {
  if (!is.character(key) || length(key) != 1 || nchar(key) == 0) {
    stop("Invalid key: key must be single non-empty string.")
  }
  if (grepl("[^a-z0-9]", key)) {
    stop("Invalid key: ", key, ". Only lowercase letters and numbers are allowed.")
  }
}
austin3087/https-github.com-rstudio-shiny documentation built on Nov. 3, 2019, 2:01 p.m.