Skip to content

Commit

Permalink
#25 include names in list0()
Browse files Browse the repository at this point in the history
  • Loading branch information
jmbarbone committed May 15, 2023
1 parent 754195c commit 955a9d9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions R/list.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
#' @examples
#' try(list(1, ))
#' list0(1, )
#' list0(a = 1, )
#' @export
list0 <- function(...) {
mc <- match.call()
out <- list()
off <- 0L

for (i in seq_len(...length())) {
tryCatch(
Expand All @@ -20,9 +22,12 @@ list0 <- function(...) {
e$call <- mc
stop(e)
}

assign("off", 1L, parent.frame()$parentenv)
}
)
}

names(out) <- names(mc)[-1L][seq_len(i - off)]
out
}

0 comments on commit 955a9d9

Please sign in to comment.