Skip to content

Commit

Permalink
No longer importing modify_at
Browse files Browse the repository at this point in the history
Avoids issue introduced with purrr 0.3.0
  • Loading branch information
aaronwolen committed Jan 29, 2019
1 parent fb59b7d commit d57b553
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 0 additions & 1 deletion NAMESPACE
Expand Up @@ -51,7 +51,6 @@ importFrom(purrr,"%||%")
importFrom(purrr,imap_chr)
importFrom(purrr,map)
importFrom(purrr,map_chr)
importFrom(purrr,modify_at)
importFrom(purrr,pluck)
importFrom(purrr,set_names)
importFrom(purrr,transpose)
Expand Down
10 changes: 6 additions & 4 deletions R/utils-api-responses.R
Expand Up @@ -83,16 +83,18 @@ raise_error <- function(x) {

# Convert datetime attributes to POSIXct objects
# param x an OSF response list that contains an attributes element
#' @importFrom purrr modify_at
parse_datetime_attrs <- function(x) {
stopifnot(is.list(x))
stopifnot("attributes" %in% names(x))

x$attributes <- purrr::modify_at(x$attributes,
.at = c("date_registered", "date_created", "date_modified", "modified_utc"),
.f = parse_datetime
dt_keys <- intersect(
c("date_registered", "date_created", "date_modified", "modified_utc"),
names(x$attributes)
)

dt_vals <- lapply(x$attributes[dt_keys], parse_datetime)

x$attributes <- modifyList(x$attributes, dt_vals)
return(x)
}

Expand Down

0 comments on commit d57b553

Please sign in to comment.