R/config.R

Defines functions delete_config set_config get_config

.CONFIG <- new.env(parent = emptyenv())

# return the stored config or NULL
get_config <- function(key) {
  get0(key, .CONFIG)
}

set_config <- function(key, value) {
  old <- get_config(key)
  assign(key, value, envir = .CONFIG)
  invisible(old)
}

delete_config <- function(key) {
  old <- get_config(key)
  suppressWarnings(rm(list = key, envir = .CONFIG))
  invisible(old)
}

Try the srcpkgs package in your browser

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

srcpkgs documentation built on May 29, 2024, 6:43 a.m.