R/utils-ndr-null.R

Defines functions `%||%`

#' Borrowed NULL
#'
#' @param x value set to a default value of null
#' @param y value to be used with x is null
#'
#' @name ndr-null-op
#' @export
#' @return No return value, called for side effects
#' @keywords internal
`%||%` <- function(x, y) {
  if (rlang::is_null(x)) {
    y
  } else {
    x
  }
}
stephenbalogun/tidyndr documentation built on Feb. 6, 2023, 11:35 p.m.