Skip to content

[F] getNodeAtPosition

Call Signature

function getNodeAtPosition(
script,
position,
filter?): undefined | Node

Resolve the node in the syntax tree that that is at the given position.

Parameters

ParameterTypeDescription
scriptTypeSpecScriptNodeTypeSpec Script node
positionnumberPosition
filter?(node) => booleanFilter if wanting to return a parent containing node early.

Returns

undefined | Node

Call Signature

function getNodeAtPosition<T>(
script,
position,
filter): undefined | T

Resolve the node in the syntax tree that that is at the given position.

Type Parameters

Type Parameter
T extends Node

Parameters

ParameterTypeDescription
scriptTypeSpecScriptNodeTypeSpec Script node
positionnumberPosition
filter(node) => node is TFilter if wanting to return a parent containing node early.

Returns

undefined | T