Skip to content

Commit 02350bb

Browse files
committed
only attach AsIs to length 1 vectors to make expect_equal happy
1 parent 2fb00ff commit 02350bb

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

R/utils.R

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,15 @@ boxers <- list(
152152
surface = c("x", "y", "z", "text")
153153
)
154154

155-
i <- function(x) if (is.null(x)) x else I(x)
155+
i <- function(x) {
156+
if (is.null(x)) {
157+
return(NULL)
158+
} else if (length(x) == 1) {
159+
return(I(x))
160+
} else{
161+
return(x)
162+
}
163+
}
156164

157165
rm_asis <- function(x) {
158166
# jsonlite converts NULL to {} and NA to null (plotly prefers null to {})

0 commit comments

Comments
 (0)