R/util.R

Defines functions as_single_raw is_raw_list

is_raw_list <- function(x) {
  if (!is.list(x))
    return(FALSE)

  raw <- vapply(x, is.raw, logical(1))
  null <- vapply(x, is.null, logical(1))

  if (!all(raw | null))
    return(FALSE)

  TRUE
}

as_single_raw <- function(x) {
  if (is.na(x)) NULL else as.raw(x)
}

Try the blob package in your browser

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

blob documentation built on March 31, 2023, 5:14 p.m.