validate_property {interface} | R Documentation |
Validate a property against a given type or validation function
Description
Validates a property to ensure it matches the expected type or satisfies the given validation function.
Usage
validate_property(name, value, validator)
Arguments
name |
The name of the property being validated. |
value |
The value of the property. |
validator |
The expected type or a custom validation function. |
Details
This function supports various types of validators: - Enum generators - Lists of multiple allowed types - Interface objects - Built-in R types (character, numeric, logical, integer, double, complex) - data.table and data.frame types - Custom validation functions
Value
Returns NULL if the validation passes, otherwise returns a character string containing an error message describing why the validation failed.
[Package interface version 0.1.2 Index]