Create an inline plugin.

inline_plugin(dev, prod)

Arguments

dev, prod

Development and production functions to run when in either state. These callback function should accept a single argument lines, a vector of character strings: the source code where each character string is a line of code. They also should accept an ellipsis ... for future extensibility.

Examples

chg_magrittr_to_native <- function(lines) {
  gsub("\\%>\\%", "|>", lines)
}

code <- 'function(x) {
  x %>%
    sum()
}'

chg_magrittr_to_native(code)
#> [1] "function(x) {\n  x |>\n    sum()\n}"