Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add method to access config values #2

Closed
psolymos opened this issue Mar 1, 2022 · 0 comments
Closed

Add method to access config values #2

psolymos opened this issue Mar 1, 2022 · 0 comments

Comments

@psolymos
Copy link
Member

psolymos commented Mar 1, 2022

Similarly to config::get() or getOption(), set a default value to use when NULL is found.

value <- function(x, ...) UseMethod("value")
value.default <- function(x, default = NULL) {
    if (is.null(x))
        default else x
}

CONFIG <- list(a=1)
value(CONFIG$a, 2)
value(CONFIG$b, 2)
@psolymos psolymos closed this as completed Apr 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant