getAncestor
Call Signature
Section titled “Call Signature”getAncestor<
TMatch>(snapshot,path,options): {node:TMatch;path:Path; } |undefined
Defined in: get-ancestor.ts:17
Find an ancestor of the node at a given path that matches a predicate. Does not check the node at the path itself, only its ancestors.
mode: 'lowest' (default) returns the nearest matching ancestor.
mode: 'highest' returns the outermost matching ancestor.
When match is a type predicate, the returned node narrows to that type.
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
"lowest" | "highest"
Returns
Section titled “Returns”{ node: TMatch; path: Path; } | undefined
Call Signature
Section titled “Call Signature”getAncestor(
snapshot,path,options): {node:PortableTextBlock;path:Path; } |undefined
Defined in: get-ancestor.ts:28
Parameters
Section titled “Parameters”snapshot
Section titled “snapshot”TraversalSnapshot
Path
options
Section titled “options”(node, path) => boolean
"lowest" | "highest"
Returns
Section titled “Returns”{ node: PortableTextBlock; path: Path; } | undefined