R/helpers.R

Defines functions stop_if_dots_not_named classes dput_to_str

dput_to_str <- function(x) {
  paste(capture.output(dput(x)), collapse = "\n")
}

classes <- function(x) {
  unname(sapply(x, class, USE.NAMES = FALSE))
}

stop_if_dots_not_named <- function(...) {
  dotlist <- list(...)
  dotnames <- names(dotlist)
  if (is.null(dotnames) || any(dotnames == "")) {
    abort("Arguments to `...` must be named")
  }
}
colin-fraser/CanonicalForms documentation built on Jan. 8, 2022, 8:42 a.m.