Skip to contents

A convenience function to check whether an object is currently using its default value. A method is implemented for validated_reactive_val() objects.

Usage

is_default(x, ...)

Arguments

x

(any) The object to test.

...

Additional arguments passed to methods.

Value

A logical value indicating whether the object is currently using its default value.

Examples

vrv <- validated_reactive_val(
  value = "good",
  default = "default",
  validation_expr = {
    if (.vrv() == "bad") {
      rlang::abort("is bad")
    }
    .vrv()
  }
)
shiny::isolate(vrv())
#> [1] "good"
shiny::isolate(is_default(vrv))
#> [1] FALSE
vrv("bad")
shiny::isolate(vrv())
#> [1] "default"
shiny::isolate(is_default(vrv))
#> [1] TRUE