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
Call Signature
Section titled “Call Signature”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.
Type Parameters
Section titled “Type Parameters”TMatch
Section titled “TMatch”TMatch extends PortableTextBlock
Parameters
Section titled “Parameters”snapshot
Section titled “snapshot”TraversalSnapshot
Path
options
Section titled “options”(node, path) => node is TMatch
Returns
Section titled “Returns”{ node: TMatch; path: Path; } | undefined
Call Signature
Section titled “Call Signature”getParent(
snapshot,path,options?): {node:PortableTextBlock;path:Path; } |undefined
Defined in: get-parent.ts:28
Parameters
Section titled “Parameters”snapshot
Section titled “snapshot”TraversalSnapshot
Path
options?
Section titled “options?”match?
Section titled “match?”(node, path) => boolean
Returns
Section titled “Returns”{ node: PortableTextBlock; path: Path; } | undefined