Skip to content

Commit

Permalink
handle unnamed lists in merge_lists function
Browse files Browse the repository at this point in the history
Unnamed lists can now be overriden by another config section (fix rstudio#24)
  • Loading branch information
vpanfilov authored Oct 11, 2019
1 parent c33e4d3 commit 33bfb0b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions R/merge.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ merge_lists <- function (base_list, overlay_list, recursive = TRUE) {
base_list
else {
merged_list <- base_list

# merge named lists
for (name in names(overlay_list)) {
base <- base_list[[name]]
overlay <- overlay_list[[name]]
Expand All @@ -38,6 +40,11 @@ merge_lists <- function (base_list, overlay_list, recursive = TRUE) {
overlay_list[which(names(overlay_list) %in% name)])
}
}

# merge unnamed lists
if (is.null(names(base_list)) && is.null(names(overlay_list))) {
merged_list <- overlay_list
}
merged_list
}
}
Expand Down

0 comments on commit 33bfb0b

Please sign in to comment.