@tmlmt/cooklang-parser / isNoteActive
Function: isNoteActive()
isNoteActive(
note,variant?):boolean
Determines if a note is active (should be displayed) for a given variant.
Parameters
note
The Note to check
variant?
string
The active variant name, or undefined/* for the default variant
Returns
boolean
true if the note should be displayed
Example
typescript
for (const item of section.content) {
if (item.type === 'note' && isNoteActive(item, choices.variant)) {
// render note
}
}