has_field() retrieves the names of all fields (including nested fields) and checks if field is among them.

has_field(.yml, field)

Arguments

.yml

a yml object created by yml(), as_yml(), or returned by a yml_*() function

field

A character vector, the name of the field(s) to check for

Value

logical

Examples


has_field(yml(), "author")
#> [1] FALSE
has_field(yml(), "toc")
#> [1] FALSE