findSection

View as MarkdownOpen in Claude

Recursively search all top-level sections and their nested subsections for one matching the given title. Unlike getSection(), this also searches subsections.

Parameters

title
stringRequired

The section heading to search for.

Returns

PomSection | undefined — The first matching section at any depth, or undefined if not found.

Example

1import { PomBuilder } from '@signalwire/sdk';
2
3const pom = new PomBuilder();
4pom.addSection('Rules', {
5 subsections: [{ title: 'Tone', body: 'Be professional and warm.' }],
6});
7const tone = pom.findSection('Tone');
8console.log(tone?.body); // "Be professional and warm."