Closed
Description
Should the following code be wrapped up in an exported helper function?
Lines 236 to 237 in 37b07cb
It is used a couple of handfuls of times in this package along with other add-on packages.
newdata_abort <- function(...) {
if (any(names(rlang::enquos(...)) == "newdata"))
rlang::abort("Did you mean to use `new_data` instead of `newdata`?")
}
test <- function(...) {
newdata_abort(...)
list(...)
}
test(new_data = "hello")
#> $new_data
#> [1] "hello"
test(newdata = "hello")
#> Error: Did you mean to use `new_data` instead of `newdata`?
Created on 2021-07-03 by the reprex package (v2.0.0)