Skip to content

Commit

Permalink
shortcut package check where already loaded and versions are not spec…
Browse files Browse the repository at this point in the history
…ified
  • Loading branch information
shikokuchuo committed Feb 20, 2025
1 parent b53ac84 commit f16c7f2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions R/session.R
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,16 @@ check_installed <- function(pkg,
action = NULL,
call = caller_env()) {
check_dots_empty0(...)

if (is.null(version)) {
loaded <- lapply(pkg, function(x) {
nzchar(x) && is.environment(.getNamespace(x))
})
if (all(as.logical(loaded))) {
return(invisible(NULL))
}
}

check_action(action)

info <- pkg_version_info(pkg, version = version, compare = compare)
Expand Down

0 comments on commit f16c7f2

Please sign in to comment.