Learn R Programming

brand.yml (version 0.1.0)

brand_has: Check if a brand has a specific nested element

Description

Checks if a given brand object has a specific nested element accessible via the additional arguments provided as key paths.

Usage

brand_has(brand, ...)

Value

TRUE if the nested element exists in the brand object, FALSE otherwise.

Arguments

brand

A brand object created by read_brand_yml() or as_brand_yml().

...

One or more character strings or symbols representing the path to the nested element.

See Also

Other brand.yml helpers: brand_color_pluck(), brand_pluck(), with_brand_yml_path()

Examples

Run this code
brand <- as_brand_yml(list(
  meta = list(name = "Example Brand"),
  color = list(primary = "#FF5733")
))

# Check if brand has a primary color
brand_has(brand, "color", "primary") # TRUE

# Check if brand has a secondary color
brand_has(brand, "color", "secondary") # FALSE

Run the code above in your browser using DataLab