R/utils.R
raw| 1 | stop_if_not <- function(...) { |
| 2 | res <- list(...) |
| 3 | n <- length(res) |
| 4 | if (n == 0L) return() |
| 5 | |
| 6 | for (ii in 1L:n) { |
| 7 | res_ii <- .subset2(res, ii) |
| 8 | if (length(res_ii) != 1L || is.na(res_ii) || !res_ii) { |
| 9 | mc <- match.call() |
| 10 | call <- deparse(mc[[ii + 1]], width.cutoff = 60L) |
| 11 | if (length(call) > 1L) call <- paste(call[1L], "...") |
| 12 | stop(sQuote(call), " is not TRUE", call. = FALSE, domain = NA) |
| 13 | } |
| 14 | } |
| 15 | } |