Skip to content
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

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.

TMatch extends Node

TraversalSnapshot

Path

"next" | "previous"

(node, path) => node is TMatch

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

getSibling(snapshot, path, options): { node: Node; path: Path; } | undefined

Defined in: get-sibling.ts:30

TraversalSnapshot

Path

"next" | "previous"

(node, path) => boolean

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