Function: attr()
attr(
el,name):string|undefined
Read an unprefixed attribute, returning undefined (never null or "")
when the attribute is absent or empty, matches the
exactOptionalPropertyTypes "omit, don't set undefined" discipline used
throughout the model.
Parameters
el
Element
name
string
Returns
string | undefined
Example
import { attr } from "@cosyte/ccda";
const root = attr(el, "root"); // string | undefined