Skip to content

Commit fc05cd9

Browse files
committed
symmetrize scalar validation
1 parent cfde0c9 commit fc05cd9

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

R/layer_add_forecast_date.R

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@
6868
#' p3
6969
layer_add_forecast_date <-
7070
function(frosting, forecast_date = NULL, id = rand_id("add_forecast_date")) {
71+
arg_is_chr_scalar(id)
72+
arg_is_scalar(forecast_date, allow_null = TRUE)
73+
# can't validate the type of forecast_date until we know the time_type
7174
add_layer(
7275
frosting,
7376
layer_add_forecast_date_new(
@@ -78,9 +81,7 @@ layer_add_forecast_date <-
7881
}
7982

8083
layer_add_forecast_date_new <- function(forecast_date, id) {
81-
arg_is_chr_scalar(id)
82-
arg_is_scalar(forecast_date, allow_null = TRUE)
83-
# can't validate forecast_date until we know the time_type
84+
8485
layer("add_forecast_date", forecast_date = forecast_date, id = id)
8586
}
8687

R/layer_add_target_date.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,9 @@
6363
#' p3
6464
layer_add_target_date <-
6565
function(frosting, target_date = NULL, id = rand_id("add_target_date")) {
66-
# can't validate target_date until we know the time_type
6766
arg_is_chr_scalar(id)
67+
arg_is_scalar(target_date, allow_null = TRUE)
68+
# can't validate the type of target_date until we know the time_type
6869
add_layer(
6970
frosting,
7071
layer_add_target_date_new(

0 commit comments

Comments
 (0)