Skip to content
7 changes: 5 additions & 2 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -414,10 +414,13 @@ select_decorators <- function(decorators, scope) {
#' @keywords internal
normalize_decorators <- function(decorators) {
if (checkmate::test_list(decorators, "teal_transform_module")) {
if (checkmate::test_names(names(decorators))) {
decorators_names <- setdiff(names(decorators), "")
if (length(decorators_names) == 0) {
list(default = decorators)
} else if (length(decorators_names) == length(decorators)) {
lapply(decorators, list)
} else {
list(default = decorators)
stop("All decorators should either be named or unnamed.")
}
} else {
decorators
Expand Down
Loading