Skip to content

Commit

Permalink
added test, fixed typo
Browse files Browse the repository at this point in the history
  • Loading branch information
edavidaja committed Aug 15, 2024
1 parent 8d2ad6e commit b10faab
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion R/imap.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ imap_dbl <- function(.x, .f, ...) {
#' @export
imap_vec <- function(.x, .f, ...) {
.f <- as_mapper(.f, ...)
map_vec(.x, vec_index(.x), .f, ...)
map2_vec(.x, vec_index(.x), .f, ...)
}


Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-imap.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ test_that("atomic vector imap works", {
expect_length(imap_chr(x, paste), 3)
expect_equal(imap_int(x, ~ .x + as.integer(.y)), x * 2)
expect_equal(imap_dbl(x, ~ .x + as.numeric(.y)), x * 2)
expect_equal(imap_vec(x, ~ .x + as.numeric(.y)), x * 2)
})

test_that("iwalk returns invisibly", {
Expand Down

0 comments on commit b10faab

Please sign in to comment.