R/expression.R

Defines functions expression_to_pattern

#' @importFrom purrr set_names map_chr
#' @importFrom stringr str_replace_all
expression_to_pattern <- function(x, parameters = get_parameters()) {
  replace <- set_names(
    map_chr(parameters, \(x) paste0("(", x$regex, ")")),
    map_chr(parameters, \(x) paste0("\\{", x$name, "\\}"))
  )
  str_replace_all(x, replace)
}

Try the cucumber package in your browser

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

cucumber documentation built on June 30, 2024, 1:07 a.m.