Skip to content

Commit 3939d39

Browse files
committed
Merge branch 'master' of github.com:hadley/blob
2 parents c3dbe57 + f1d4bf7 commit 3939d39

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

R/format.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ obj_sum.blob <- function(x) {
3131
#' @importFrom tibble is_vector_s3
3232
is_vector_s3.blob <- function(x) TRUE
3333

34-
blob_size <- function(x, digits = 3, trim = TRUE) {
34+
blob_size <- function(x, digits = 3, trim = TRUE, ...) {
3535
x <- vapply(x, length, integer(1))
3636

3737
power <- min(floor(log(abs(x), 1000)), 4)
@@ -42,7 +42,7 @@ blob_size <- function(x, digits = 3, trim = TRUE) {
4242
x <- x / (1024 ^ power)
4343
}
4444

45-
x1 <- signif(x, digits = digits)
45+
x1 <- signif(x, digits = digits %||% 3)
4646
x2 <- format(x1, big.mark = ",", scientific = FALSE, trim = trim)
4747
paste0(x2, " ", unit)
4848
}

R/util.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ is_raw_list <- function(x) {
1111
TRUE
1212
}
1313

14+
`%||%` <- function(x, y) if (is.null(x)) y else x

0 commit comments

Comments
 (0)