Skip to content

@tmlmt/cooklang-parser / Section

Class: Section ​

Represents a recipe section

Wrapped as a Class and not defined as a simple Type to expose some useful helper classes (e.g. isBlank())

Constructors ​

Constructor ​

new Section(name): Section

Creates an instance of Section.

Parameters ​

name ​

string = ""

The name of the section. Defaults to an empty string.

Returns ​

Section

Properties ​

content ​

content: (Step | Note)[] = []

An array of steps and notes that make up the content of the section.


name ​

name: string

The name of the section. Can be an empty string for the default (first) section.

Default Value ​

""

Methods ​

isBlank() ​

isBlank(): boolean

Checks if the section is blank (has no name and no content). Used during recipe parsing

Returns ​

boolean

true if the section is blank, otherwise false.