#' Validate parameter list structure
#'
#' @param parameterStructure Object to be checked. Expected is a named list
#' with names "paths", "values", and "units".
#'
#' @keywords internal
#'
#' @return `TRUE` if validation succeeded (silently). Throws an error otherwise.
.validateParametersStructure <- function(parameterStructure, argumentName = NULL,
nullAllowed = FALSE) {
if (is.null(parameterStructure) && nullAllowed) {
return(invisible(TRUE))
}
if (!identical(names(parameterStructure), c("paths", "values", "units"))) {
stop(messages$wrongParametersStructure(argumentName = argumentName))
}
return(invisible(TRUE))
}
#' Check if the `object` contains active binding with the name `field`
#'
#' @param object A class or an instance of a class to check
#' @param field Name of the field
#'
#' @return `TRUE` if the `object` has an active binding `field`,
#' `FALSE? otherwise.
#' @keywords internal
.validateClassHasField <- function(object, field) {
if (!any(names(object) == field)) {
return(FALSE)
}
return(TRUE)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.