R/validators.R

Defines functions validate_one_of

# Validate that a given parameter belongs to a list
validate_one_of <- function(param, one_of) {
  param_name <- deparse(substitute(param))
  error_message <- param_name %+% " must be one of: " %+% paste(one_of, collapse = ", ")
  if(!param %in% one_of) stop(error_message)
}

Try the RedditExtractoR package in your browser

Any scripts or data that you put into this service are public.

RedditExtractoR documentation built on March 31, 2023, 5:18 p.m.