From 6474e17ccd795132d487bf6f398477c189e47695 Mon Sep 17 00:00:00 2001 From: Tan Ho Date: Sat, 11 Feb 2023 13:28:07 -0700 Subject: [PATCH] use inherits to check classes --- R/0_helpers.R | 2 +- R/mfl_players.R | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/0_helpers.R b/R/0_helpers.R index 1f92a7f7..c159c2b6 100644 --- a/R/0_helpers.R +++ b/R/0_helpers.R @@ -12,7 +12,7 @@ date <- Sys.Date() } - if (class(date) != "Date") { + if (!inherits(date, "Date")) { date <- as.Date(date) } diff --git a/R/mfl_players.R b/R/mfl_players.R index 1ccc01e2..ee527f9e 100644 --- a/R/mfl_players.R +++ b/R/mfl_players.R @@ -18,7 +18,7 @@ #' @export mfl_players <- function(conn = NULL) { - if (!is.null(conn) && class(conn) != "mfl_conn") { + if (!is.null(conn) && !inherits(conn, "mfl_conn")) { stop("conn must be generated by 'mfl_connect()' and have type 'mfl_conn'") }