Skip to content

JSONPath Tools / @jsonpath-tools/jsonpath / FilterExpression

Class: abstract FilterExpression

Expression in a filter selector.

Extends

Extended by

Constructors

new FilterExpression()

ts
new FilterExpression(children): FilterExpression

Parameters

children

(null | SyntaxTree)[]

Children.

Returns

FilterExpression

Inherited from

SyntaxTreeNode.constructor

Properties

_parent

ts
_parent: null | SyntaxTreeNode = null;

Internal

Inherited from

SyntaxTreeNode._parent


children

ts
readonly children: SyntaxTree[];

Children.

Inherited from

SyntaxTreeNode.children


length

ts
readonly length: number;

Length in the text.

Inherited from

SyntaxTreeNode.length


position

ts
readonly position: number;

Position in the text.

Inherited from

SyntaxTreeNode.position


type

ts
abstract readonly type: SyntaxTreeType;

Type.

Inherited from

SyntaxTreeNode.type

Accessors

parent

Get Signature

ts
get parent(): null | SyntaxTreeNode

Parent or null when no parent is assigned.

Returns

null | SyntaxTreeNode

Inherited from

SyntaxTreeNode.parent


skippedTextBefore

Get Signature

ts
get skippedTextBefore(): string

Text that was skipped during parsing.

Returns

string

Text that was skipped during parsing.

Inherited from

SyntaxTreeNode.skippedTextBefore


textRange

Get Signature

ts
get textRange(): TextRange

Range in the text.

Returns

TextRange

Inherited from

SyntaxTreeNode.textRange


textRangeWithoutSkipped

Get Signature

ts
get textRangeWithoutSkipped(): TextRange

Range in the text excluding skipped text before.

Returns

TextRange

Inherited from

SyntaxTreeNode.textRangeWithoutSkipped

Methods

evaluate()

ts
evaluate(queryContext, filterExpressionContext): FilterValue

Evaluates the expression in the given context and returns its value.

Parameters

queryContext

QueryContext

Query context.

filterExpressionContext

FilterExpressionContext

Filter expression context.

Returns

FilterValue


evaluateImplementation()

ts
abstract protected evaluateImplementation(queryContext, filterExpressionContext): FilterValue

Evaluates the expression in the given context and returns its value.

Parameters

queryContext

QueryContext

Query context.

filterExpressionContext

FilterExpressionContext

Filter expression context.

Returns

FilterValue


forEach()

ts
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

SyntaxTreeNode.forEach


getAtPosition()

ts
getAtPosition(characterPosition): null | SyntaxTree

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

null | SyntaxTree

Inherited from

SyntaxTreeNode.getAtPosition


getContainingAtPosition()

ts
getContainingAtPosition(caretPosition): null | SyntaxTree

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

null | SyntaxTree

Inherited from

SyntaxTreeNode.getContainingAtPosition


getTouchingAtPosition()

ts
getTouchingAtPosition(caretPosition): SyntaxTree[]

Returns all innermost subtrees that touch the given caret position.

Parameters

caretPosition

number

Position (caret position index).

Returns

SyntaxTree[]

Inherited from

SyntaxTreeNode.getTouchingAtPosition