R/utils.R

Defines functions .find_failures `%&&%` .glue2

.glue2 <- function(..., env = caller_env()) {
  glue(..., .envir = env, .open = "[", .close = "]")
}

`%&&%` <- function(x, y) {
  if (is.null(x)) {
    NULL
  } else {
    y
  }
}

.find_failures <- function(x, check_value, check_fn) {
  failures <- check_value %&&% check_fn(x, check_value)

  if (any(failures)) {
    return(which(failures))
  }

  return(NULL)
}

Try the stbl package in your browser

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

stbl documentation built on May 29, 2024, 5:52 a.m.