⚠️ This is pre-release documentation for v3. For stable docs, visit v2.
Skip to content

@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

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
  }
}