JSONPath Tools / @jsonpath-tools/jsonpath / SliceSelector
Class: SliceSelector
Slice selector.
Extends
Constructors
new SliceSelector()
new SliceSelector(
startToken,
firstColonToken,
endToken,
secondColonToken,
stepToken,
start,
end,
step): SliceSelector
Parameters
startToken
Range start index token.
null
| SyntaxTreeToken
firstColonToken
Colon token delimiting start and end tokens.
endToken
Range end index token.
null
| SyntaxTreeToken
secondColonToken
Colon token delimiting end and step tokens.
null
| SyntaxTreeToken
stepToken
Range step token.
null
| SyntaxTreeToken
start
Range start index (inclusive).
null
| number
end
Range end index (exclusive).
null
| number
step
Range step.
null
| number
Returns
SliceSelector
Overrides
Properties
_parent
_parent: null | SyntaxTreeNode = null;
Internal
Inherited from
children
readonly children: SyntaxTree[];
Children.
Inherited from
end
readonly end: null | number;
Range end index (exclusive).
endToken
readonly endToken: null | SyntaxTreeToken;
Range end index token.
firstColonToken
readonly firstColonToken: SyntaxTreeToken;
Colon token delimiting start and end tokens.
length
readonly length: number;
Length in the text.
Inherited from
position
readonly position: number;
Position in the text.
Inherited from
secondColonToken
readonly secondColonToken: null | SyntaxTreeToken;
Colon token delimiting end and step tokens.
start
readonly start: null | number;
Range start index (inclusive).
startToken
readonly startToken: null | SyntaxTreeToken;
Range start index token.
step
readonly step: null | number;
Range step.
stepToken
readonly stepToken: null | SyntaxTreeToken;
Range step token.
Accessors
parent
Get Signature
get parent(): null | SyntaxTreeNode
Parent or null
when no parent is assigned.
Returns
null
| SyntaxTreeNode
Inherited from
skippedTextBefore
Get Signature
get skippedTextBefore(): string
Text that was skipped during parsing.
Returns
string
Text that was skipped during parsing.
Inherited from
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
Selector
.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): 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
getContainingAtPosition()
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
Selector
.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
Selector
.getTouchingAtPosition
select()
select(
input,
output,
queryContext): void
Selects nodes from the input node to the output array.
Parameters
input
Input node.
output
Output nodes.
queryContext
Query context.
Returns
void