R/current.R

Defines functions current

Documented in current

#' Get the current value of an Iterator without changing its state
#'
#' @description An `Iterator` `yield`s a variable every time `yield_next()` is called.
#' Get the current value of that variable without changing the state of the Iterator.
#'
#' @param iter An `Iterator` object
#'
#' @return The current value of `iter`
#' @export

current <- function(iter) {
  iter$initial[[as.character(iter$yield)]]
}

Try the peruse package in your browser

Any scripts or data that you put into this service are public.

peruse documentation built on March 8, 2021, 9:06 a.m.