Skip to content

Commit

Permalink
Merge pull request #157 from M3nin0/dev
Browse files Browse the repository at this point in the history
fix unavailable items properties handling
  • Loading branch information
rolfsimoes authored Jun 10, 2024
2 parents f8e2b2b + eea9977 commit 15d78bf
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion R/items-funs.R
Original file line number Diff line number Diff line change
Expand Up @@ -695,9 +695,16 @@ items_as_tibble.doc_item <- function(items) {
items_as_tibble.doc_items <- function(items) {
check_items(items)
non_atomic <- non_atomic_properties(items)
properties <- items_fields(items, "properties")
data <- lapply(items$features, function(item) {
# fill unavailable properties
unavailable_properties <- setdiff(properties, names(item$properties))
item$properties[unavailable_properties] <- NA
# update non-atomic properties
item$properties[non_atomic] <- lapply(item$properties[non_atomic], list)
item$properties
# return properties from items in the same order
# to avoid errors in the `mapply`
item$properties[properties]
})
data <- do.call(mapply, args = c(list(FUN = c, SIMPLIFY = FALSE), data))
structure(
Expand Down

0 comments on commit 15d78bf

Please sign in to comment.