R/utils.R

Defines functions is_pkgapi_error json_null scalar schema_root hintr2_file

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

schema_root <- function() {
  hintr2_file("schema")
}

scalar <- function(val) {
  if (inherits(val, "scalar")) {
    val
  } else {
    jsonlite::unbox(val)
  }
}

json_null <- function() {
  null <- "null"
  class(null) <- "json"
  null
}

is_pkgapi_error <- function(e) {
  inherits(e, "pkgapi_error")
}
mrc-ide/hintr2 documentation built on Sept. 8, 2020, 12:54 p.m.