R/utils.R

Defines functions check_args validate_target

validate_target <- function(x) {
  if (is.null(x)) {
    return(NULL)
  }

  paste0("#", x)
}

check_args <- function(target, text) {
  if (!is.null(target) & !is.null(text)) {
    stop("Only define target OR text.")
  }

  if (is.null(target) & is.null(text)) {
    stop("You must define target OR text.")
  }
}
ndiquattro/clipboardjs documentation built on March 17, 2022, 5:18 p.m.