R/yaml_delimiter_indices.R

Defines functions yaml_delimiter_indices

Documented in yaml_delimiter_indices

#' Get indices of YAML delimiters
#'
#' @param x The character vector.
#'
#' @return A numeric vector.
#'
#' @examples yaml_delimiter_indices(
#'   c("not here",
#'     "---",
#'     "above this one",
#'     "but nothing here",
#'     "below this one, too",
#'     "---")
#' );
#' ### [1] 2 6
#' @export
yaml_delimiter_indices <- function(x) {
  return(grep("^\\s*\\-\\-\\-\\s*$", x));
}

Try the rock package in your browser

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

rock documentation built on Dec. 28, 2022, 1:55 a.m.