R/helpers.R

Defines functions `%||%` str_collapse

str_collapse <- function(str) {
  sprintf("{%s}", paste0(str, collapse = ", "))
}

# With thanks to rlang
`%||%` <- function(x, y) {
  if (is.null(x)) {
    y
  } else {
    x
  }
}
xoopR/ooplah documentation built on April 5, 2022, 4:19 a.m.