Skip to content

JSONPath Tools / @jsonpath-tools/jsonpath / FunctionExpression

Class: FunctionExpression

Function.

Extends

Constructors

Constructor

ts
new FunctionExpression(
   nameToken, 
   openingParanthesisToken, 
   args, 
   closingParanthesisToken, 
   name): FunctionExpression;

Parameters

nameToken

SyntaxTreeToken

Name token.

openingParanthesisToken

SyntaxTreeToken

Opening paranthesis token.

args

readonly object[]

Arguments.

closingParanthesisToken

SyntaxTreeToken

Closing paranthesis token.

name

string

Name.

Returns

FunctionExpression

Overrides

FilterExpression.constructor

Properties

_parent

ts
_parent: SyntaxTreeNode | null = null;

Internal

Inherited from

FilterExpression._parent


args

ts
readonly args: readonly object[];

Arguments.


children

ts
readonly children: SyntaxTree[];

Children.

Inherited from

FilterExpression.children


closingParanthesisToken

ts
readonly closingParanthesisToken: SyntaxTreeToken;

Closing paranthesis token.


length

ts
readonly length: number;

Length in the text.

Inherited from

FilterExpression.length


name

ts
readonly name: string;

Name.


nameToken

ts
readonly nameToken: SyntaxTreeToken;

Name token.


openingParanthesisToken

ts
readonly openingParanthesisToken: SyntaxTreeToken;

Opening paranthesis token.


position

ts
readonly position: number;

Position in the text.

Inherited from

FilterExpression.position

Accessors

parent

Get Signature

ts
get parent(): SyntaxTreeNode | null;

Parent or null when no parent is assigned.

Returns

SyntaxTreeNode | null

Inherited from

FilterExpression.parent


skippedTextBefore

Get Signature

ts
get skippedTextBefore(): string;

Text that was skipped during parsing.

Returns

string

Text that was skipped during parsing.

Inherited from

FilterExpression.skippedTextBefore


textRange

Get Signature

ts
get textRange(): TextRange;

Range in the text.

Returns

TextRange

Inherited from

FilterExpression.textRange


textRangeWithoutSkipped

Get Signature

ts
get textRangeWithoutSkipped(): TextRange;

Range in the text excluding skipped text before.

Returns

TextRange

Inherited from

FilterExpression.textRangeWithoutSkipped


type

Get Signature

ts
get type(): SyntaxTreeType;

Type.

Returns

SyntaxTreeType

Type.

Overrides

FilterExpression.type

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

Inherited from

FilterExpression.evaluate


evaluateImplementation()

ts
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

Overrides

FilterExpression.evaluateImplementation


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

FilterExpression.forEach


getAtPosition()

ts
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

FilterExpression.getAtPosition


getContainingAtPosition()

ts
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

FilterExpression.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

FilterExpression.getTouchingAtPosition