R/utils.R

Defines functions `%||%` pkg_file spaces dbg

`%||%` <- function(x, y) if (is.null(x)) y else x

pkg_file <- function(...) {
  system.file(..., package = "shinyThings", mustWork = TRUE)
}

spaces <- function(...) {
  x <- lapply(list(...), function(x) paste(x, collapse = " "))
  paste(x, collapse = " ")
}

dbg <- function(..., id = NULL) {
  if (getOption("shinyThings.debug", FALSE)) {
    id <- if (!is.null(id)) paste0("[", id, "] ")
    message(id, ..., appendLF = TRUE)
  }
}
gadenbuie/shinyThings documentation built on Nov. 24, 2019, 6:56 p.m.