R/check-arguments.R

Defines functions check_quantity check_active

# nocov start

check_active <- function(active) {
  if (is.logical(active)) {
    active <- ifelse(active, "ACTIVE", "INACTIVE")
  } else if (!is.character(active) || !(active %in% c("ACTIVE", "INACTIVE"))) {
    stop('Argument "active" must be either TRUE, FALSE, "ACTIVE" or "INACTIVE".')
  }

  active
}

check_quantity <- function(quantity) {
  if (!(quantity %in% c("budget", "time"))) stop("Invalid quantity.")
}

# nocov end

Try the clockify package in your browser

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

clockify documentation built on Sept. 2, 2023, 9:08 a.m.