R/compat-purrr.R

Defines functions map_mold map_lgl map_int

map_mold <- function(.x, .f, .mold, ...) {
  out <- vapply(.x, rlang::as_function(.f), .mold, ..., USE.NAMES = FALSE)
  names(out) <- names(.x)
  out
}

map_lgl <- function(.x, .f, ...) {
  map_mold(.x, .f, logical(1), ...)
}

map_int <- function(.x, .f, ...) {
  map_mold(.x, .f, integer(1), ...)
}
shunsambongi/enum documentation built on Nov. 11, 2019, 6:46 a.m.