Skip to main content

Class: IndexSelector

jsonpath.selectors.IndexSelector

Array index selector.

Hierarchy

Constructors

constructor

new IndexSelector(environment, token, index): IndexSelector

Parameters

NameType
environmentJSONPathEnvironment
tokenToken
indexnumber

Returns

IndexSelector

Overrides

JSONPathSelector.constructor

Defined in

src/path/selectors.ts:89

Properties

environment

Readonly environment: JSONPathEnvironment

Inherited from

JSONPathSelector.environment

Defined in

src/path/selectors.ts:90


index

Readonly index: number

Defined in

src/path/selectors.ts:92


token

Readonly token: Token

The token at the start of this selector.

Inherited from

JSONPathSelector.token

Defined in

src/path/selectors.ts:91

Methods

lazyResolve

lazyResolve(nodes): Generator<JSONPathNode, any, unknown>

Parameters

NameTypeDescription
nodesIterable<JSONPathNode>Nodes matched by preceding selectors.

Returns

Generator<JSONPathNode, any, unknown>

Overrides

JSONPathSelector.lazyResolve

Defined in

src/path/selectors.ts:122


normalizedIndex

normalizedIndex(length): number

Parameters

NameType
lengthnumber

Returns

number

Defined in

src/path/selectors.ts:141


resolve

resolve(nodes): JSONPathNode[]

Parameters

NameTypeDescription
nodesJSONPathNode[]Nodes matched by preceding selectors.

Returns

JSONPathNode[]

Overrides

JSONPathSelector.resolve

Defined in

src/path/selectors.ts:103


toString

toString(): string

Return a canonical string representation of this selector.

Returns

string

Overrides

JSONPathSelector.toString

Defined in

src/path/selectors.ts:137