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

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