JSONPath Tools / @jsonpath-tools/jsonpath / Query
Class: Query
JSONPath query.
Extends
Constructors
Constructor
new Query(
query,
endOfFileToken,
syntaxDiagnostics): Query;Parameters
query
Actual query.
endOfFileToken
End-of-file token. Its main purpose is to collect a skipped text after the query in its SyntaxTreeToken.skippedTextBefore.
syntaxDiagnostics
readonly Diagnostics[]
Diagnostics of the query related to syntax.
Returns
Query
Overrides
Properties
_parent
_parent: SyntaxTreeNode | null = null;Internal
Inherited from
children
readonly children: SyntaxTree[];Children.
Inherited from
endOfFileToken
readonly endOfFileToken: SyntaxTreeToken;End-of-file token. Its main purpose is to collect a skipped text after the query in its SyntaxTreeToken.skippedTextBefore.
length
readonly length: number;Length in the text.
Inherited from
position
readonly position: number;Position in the text.
Inherited from
query
readonly query: SubQuery;Actual query.
syntaxDiagnostics
readonly syntaxDiagnostics: readonly Diagnostics[];Diagnostics of the query related to syntax.
Accessors
parent
Get Signature
get parent(): SyntaxTreeNode | null;Parent or null when no parent is assigned.
Returns
SyntaxTreeNode | null
Inherited from
skippedTextBefore
Get Signature
get skippedTextBefore(): string;Text that was skipped during parsing.
Returns
string
Text that was skipped during parsing.
Inherited from
SyntaxTreeNode.skippedTextBefore
textRange
Get Signature
get textRange(): TextRange;Range in the text.
Returns
Inherited from
textRangeWithoutSkipped
Get Signature
get textRangeWithoutSkipped(): TextRange;Range in the text excluding skipped text before.
Returns
Inherited from
SyntaxTreeNode.textRangeWithoutSkipped
type
Get Signature
get type(): SyntaxTreeType;Type.
Returns
Type.
Overrides
Methods
forEach()
forEach(action): void;Executes the given action for this and all descendant trees in a pre-order tree traversal.
Parameters
action
(tree) => boolean | void
Action.
Returns
void
Inherited from
getAtPosition()
getAtPosition(characterPosition): SyntaxTree | null;Returns the innermost subtree that spans the given character position or null when the position is outside of a range of the current tree.
Parameters
characterPosition
number
Position (character index).
Returns
SyntaxTree | null
Inherited from
getContainingAtPosition()
getContainingAtPosition(caretPosition): SyntaxTree | null;Returns the innermost subtree that fully contains the given caret position (not just touches) or null when the position is not contained in a range of the current tree.
Parameters
caretPosition
number
Position (caret position index).
Returns
SyntaxTree | null
Inherited from
SyntaxTreeNode.getContainingAtPosition
getTouchingAtPosition()
getTouchingAtPosition(caretPosition): SyntaxTree[];Returns all innermost subtrees that touch the given caret position.
Parameters
caretPosition
number
Position (caret position index).
Returns
Inherited from
SyntaxTreeNode.getTouchingAtPosition
select()
select(queryContext): NodeList;Selects nodes from the given query argument.
Parameters
queryContext
Query context.