R/zzz.R

Defines functions `%||%` assert cpt

cpt <- function(l) Filter(Negate(is.null), l)

assert <- function(x, y) {
  if (!is.null(x)) {
    if (!inherits(x, y)) {
      stop(deparse(substitute(x)), " must be of class ",
           paste0(y, collapse = ", "), call. = FALSE)
    }
  }
}

`%||%` <- function(x, y) if (is.null(x)) y else x
ropenscilabs/oauthlib documentation built on Sept. 6, 2020, 12:15 a.m.