R/dots.R

Defines functions check_dots_empty dots_n

dots_n <- function(...) {
  nargs()
}

# Like `ellipsis::check_dots_empty()` but without the import
check_dots_empty <- function(fn, ...) {
  n <- dots_n(...)

  if (n == 0L) {
    return(invisible())
  }

  msg <- paste0(
    "`...` is not empty in `", fn, "()`.\n",
    "These dots only exist to allow for future extensions and should be empty.\n",
    "Did you misspecify an argument?"
  )

  stop(msg, call. = FALSE)
}
DavisVaughan/timewarp documentation built on Nov. 3, 2023, 5:36 p.m.