assert_is_typeof: Assert typeof

View source: R/type-assertions.R

assert_is_typeofR Documentation

Assert typeof

Description

Raises an assertion error when typeof(obj) != type.

Usage

assert_is_typeof(
  obj,
  type,
  error_message = "{.arg obj} must be of type {.cls {type}}",
  error_class = NULL
)

Arguments

obj

<any> any value

type

<string> the expected type

error_message

<string> a message to be displayed when assertion fails.

error_class

<character> the class name/s for the error.

See Also

Other type-assertions: assert_inherits(), assert_is_character(), assert_is_double(), assert_is_integerish(), assert_is_integer(), assert_is_logical(), assert_is_numeric(), assert_is_raw()


qfes/tidyassert documentation built on March 19, 2022, 7:18 a.m.