R/assertions.R

Defines functions is_timeout is_flag is_string

is_string <- function(x) {
  is.character(x) && length(x) == 1 && !is.na(x)
}

is_flag <- function(x) {
  is.logical(x) && length(x) == 1 && !is.na(x)
}

is_timeout <- function(x) {
  is.numeric(x) && length(x) == 1 && !is.na(x) && x >= 0
}
r-lib/filelock documentation built on Jan. 4, 2024, 7:48 a.m.