Skip to content
This page is available as Markdown at /api/traversal/functions/getparent.md. For the full documentation index, see /llms.txt, or the complete corpus at /llms-full.txt.

getParent

getParent<TMatch>(snapshot, path, options): { node: TMatch; path: Path; } | undefined

Defined in: get-parent.ts:18

Get the parent of a node at a given path.

A parent has children, so it is always a PortableTextBlock (text block or object node).

When match is provided and the parent does not satisfy it, returns undefined.

TMatch extends PortableTextBlock

TraversalSnapshot

Path

(node, path) => node is TMatch

{ node: TMatch; path: Path; } | undefined

getParent(snapshot, path, options?): { node: PortableTextBlock; path: Path; } | undefined

Defined in: get-parent.ts:28

TraversalSnapshot

Path

(node, path) => boolean

{ node: PortableTextBlock; path: Path; } | undefined