diff --git a/R/parse_row_filters.R b/R/parse_row_filters.R index 67fa5bb..f17e177 100644 --- a/R/parse_row_filters.R +++ b/R/parse_row_filters.R @@ -8,8 +8,21 @@ parse_row_filters <- function(row_filters) { return(NULL) } - if (!inherits(row_filters, "list")) { - cli::cli_abort("{.arg row_filters} must be a {.cls list}, not a {.cls {class(row_filters)}}.") + # Check if `row_filters` is a list or a character vector + if (!is.list(row_filters) && !is.character(row_filters)) { + cli::cli_abort("{.arg row_filters} must be a named {.cls list} or a named {.cls character} vector, not a {.cls {class(row_filters)}}.") + } + + # If it's a list, ensure it's depth 1 and elements are named + if (is.list(row_filters)) { + if (any(lengths(row_filters) > 1) || any(names(row_filters) == "")) { + cli::cli_abort("{.arg row_filters} must be a list of depth 1 with named elements.") + } + } + + # If it's a character vector, ensure it's named + if (is.character(row_filters) && any(names(row_filters) == "")) { + cli::cli_abort("{.arg row_filters} must be a named character vector.") } # check if any filters in list have length > 1