This page is available as Markdown at /api/traversal/functions/getsibling.md. For the full documentation index, see /llms.txt, or the complete corpus at /llms-full.txt.
getSibling
Call Signature
Section titled “Call Signature”getSibling<
TMatch>(snapshot,path,options): {node:TMatch;path:Path; } |undefined
Defined in: get-sibling.ts:19
Get a sibling of the node at a given path.
Without match, returns the immediate next or previous sibling.
With match, returns the first sibling in direction that satisfies
the predicate.
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 Node
Parameters
Section titled “Parameters”snapshot
Section titled “snapshot”TraversalSnapshot
Path
options
Section titled “options”direction
Section titled “direction”"next" | "previous"
(node, path) => node is TMatch
Returns
Section titled “Returns”{ node: TMatch; path: Path; } | undefined
Call Signature
Section titled “Call Signature”getSibling(
snapshot,path,options): {node:Node;path:Path; } |undefined
Defined in: get-sibling.ts:30
Parameters
Section titled “Parameters”snapshot
Section titled “snapshot”TraversalSnapshot
Path
options
Section titled “options”direction
Section titled “direction”"next" | "previous"
match?
Section titled “match?”(node, path) => boolean
Returns
Section titled “Returns”{ node: Node; path: Path; } | undefined