R/util-fns_equal.R

Defines functions fns_equal

Documented in fns_equal

#' Check whether two function objects have the same text definition.
#'
#' @param x First function to compare.
#' @param y Second function to compare.
#'
#' @return Logical
fns_equal <- function(x, y) {
  if (!rlang::is_function(x) || !rlang::is_function(y)) {
    stop("`x` and `y` must be functions.")
  }

  deparse1(x) == deparse1(y)
}

Try the filecacher package in your browser

Any scripts or data that you put into this service are public.

filecacher documentation built on May 29, 2024, 7:35 a.m.