findSection

View as MarkdownOpen in Claude

Recursively search all top-level sections and their nested subsections for one matching the given title.

Parameters

title
stringRequired

The section heading to search for.

Returns

Section | null — The first matching section at any depth, or null if not found.

Example

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