validateEnumValue: Check if 'value' is in the given 'enum'. If not, stops with...

View source: R/validation-helpers.R

validateEnumValueR Documentation

Check if value is in the given enum. If not, stops with an error.

Description

Check if value is in the given enum. If not, stops with an error.

Usage

validateEnumValue(value, enum, nullAllowed = FALSE)

Arguments

value

A value to search for in the enum.

enum

enum where the value should be contained.

nullAllowed

If TRUE, value can be NULL and the test always passes. If FALSE (default), NULL is not accepted and the test fails.

Examples

Symbol <- enum(c(Diamond = 1, Triangle = 2, Circle = 2))
validateEnumValue(1, Symbol)

ospsuite.utils documentation built on March 18, 2022, 6:44 p.m.