Skip to content

Instantly share code, notes, and snippets.

@cosi1
Created September 8, 2018 19:17
Show Gist options
  • Save cosi1/7234dc2bcb00b990dfd4e82c5735537a to your computer and use it in GitHub Desktop.
Save cosi1/7234dc2bcb00b990dfd4e82c5735537a to your computer and use it in GitHub Desktop.
Feature toggles in R
`%||%` = function(x, y) {
if (!identical(x, FALSE)) x else y
}
toggle = function(fun, env_var = "env", dev_env = "dev") {
if (Sys.getenv(env_var) == dev_env) fun else FALSE
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment