Skip to content

Commit

Permalink
refactor: rename is_list_of to is_list_all
Browse files Browse the repository at this point in the history
  • Loading branch information
elipousson committed May 5, 2023
1 parent f3561df commit 94d1595
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export(is_ggproto)
export(is_gist_url)
export(is_gmap_url)
export(is_gsheet_url)
export(is_list_of)
export(is_list_all)
export(is_lonlat_crs)
export(is_margin)
export(is_named)
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# isstatic development

* Rename `is_list_of()` to `is_list_all()` to avoid name conflict with `vctrs::is_list_of()`
* Add `is_file()`, `is_dir()`, `has_min_length()` and `has_max_length()` functions.
* Make `str_fileext()` length stable (although functions may now return NA values).

Expand Down
6 changes: 3 additions & 3 deletions R/is_list.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#' @param x Object to be tested.
#' @param what A character vector naming classes.
#' @export
is_list_of <- function(x, what = NULL) {
is_list_all <- function(x, what = NULL) {
is.list(x) && all(vapply(x, FUN = inherits, FUN.VALUE = TRUE, what))
}

Expand All @@ -16,7 +16,7 @@ is_list_of <- function(x, what = NULL) {
#' @param x Object to be tested.
#' @export
is_gg_list <- function(x) {
is_list_of(x, "gg")
is_list_all(x, "gg")
}


Expand All @@ -25,5 +25,5 @@ is_gg_list <- function(x) {
#' @param x Object to be tested.
#' @export
is_sf_list <- function(x) {
is_list_of(x, "sf")
is_list_all(x, "sf")
}
6 changes: 3 additions & 3 deletions inst/staticexports/is_list.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#' @param x Object to be tested.
#' @param what A character vector naming classes.
#' @noRd
is_list_of <- function(x, what = NULL) {
is_list_all <- function(x, what = NULL) {
is.list(x) && all(vapply(x, FUN = inherits, FUN.VALUE = TRUE, what))
}

Expand All @@ -13,7 +13,7 @@ is_list_of <- function(x, what = NULL) {
#' @param x Object to be tested.
#' @noRd
is_gg_list <- function(x) {
is_list_of(x, "gg")
is_list_all(x, "gg")
}


Expand All @@ -22,5 +22,5 @@ is_gg_list <- function(x) {
#' @param x Object to be tested.
#' @noRd
is_sf_list <- function(x) {
is_list_of(x, "sf")
is_list_all(x, "sf")
}
6 changes: 3 additions & 3 deletions man/is_blank.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions man/is_list_of.Rd → man/is_list_all.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 94d1595

Please sign in to comment.