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)
}

Try the warp package in your browser

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

warp documentation built on Nov. 3, 2023, 1:07 a.m.