An ordered heterogeneous collection of parser entities.

remarks

The constructor retains the supplied array and its element references. getElements likewise exposes the live backing array. Use copy for an independent collection; it copies every contained parser entity. each and indexed assignment mutate the collection. A callback passed to each may return a replacement value or return nothing to leave the current value unchanged. Use forEach for observation-only iteration. Evaluation and expansion operate on a deep copy. Equality and relational predicates compare corresponding elements and return false for a non-Collection or length mismatch; these component-wise predicates do not define a lexicographic ordering for heterogeneous values.

Members

__get__(indices: number[]): ParserEntityMethod

Returns the element at the given index.

Parameters

NameTypeDescription
indicesnumber[]A single-element array [i]

Returns

ParserEntity

__set__(indices: number[], value: ParserEntity): voidMethod

Sets the element at the given index.

Parameters

NameTypeDescription
indicesnumber[]A single-element array [i]
valueParserEntityThe value to set

Returns

void

[iterator](): Iterator<ParserEntity>Method

Iterates over the stored entity references in insertion order.

Returns

Iterator<ParserEntity>

at(index: number): ParserEntity | undefinedMethod

Returns the stored entity reference at a zero-based index, or undefined when absent.

Parameters

NameTypeDescription
indexnumber—

Returns

ParserEntity | undefined

buildFunction(argsArray?: string[]): (...args: number[]): numberMethod

Compiles this value to a native JavaScript-number function when the parsed result is an Expression. Structured parser results expose this method so values returned by nerdamer(...) have one consistent TypeScript surface, but they cannot be compiled as scalar functions and throw core!UnexpectedDataType when called.

Parameters

NameTypeDescription
argsArraystring[]Optional variable names in positional call order.

Returns

(...args: number[]): number — A JavaScript-number function compiled from the scalar expression.

count(): numberMethod

Returns the number of values in the collection.

Returns

number

dataType: "COL"Property

Runtime type discriminator for collections.

dimensions(): number[]Method

Returns the collection length as a one-dimensional shape.

Returns

number[]

dimensionsMatch(x: ParserEntity): xMethod

No description is available yet.

Parameters

NameTypeDescription
xParserEntity—

Returns

x

each(callback: (a: ParserEntity, b: number): void | ParserEntity): thisMethod

Visits or replaces values in ascending index order. Returning a ParserEntity replaces the current value. Returning void leaves that value unchanged, so callers can inspect a collection without a dummy return. Use forEach when no transformation is intended.

Parameters

NameTypeDescription
callback(a: ParserEntity, b: number): void | ParserEntityFunction receiving each value and index.

Returns

this

elements: ParserEntity[]Property

Live array containing the collection's values.

eq(x: ParserEntity): booleanMethod

Tests whether another Collection has equal values in the same order.

Parameters

NameTypeDescription
xParserEntityValue to compare.

Returns

boolean

evaluate(): CollectionMethod

Evaluates a copied collection, leaving this one unchanged.

Returns

Collection

forEach(callback: (value: ParserEntity, index: number): void): voidMethod

Visits stored entity references without changing the collection.

Parameters

NameTypeDescription
callback(value: ParserEntity, index: number): void—

Returns

void

getElements(): ParserEntity[]Method

Returns the live backing array; mutations to it affect this Collection.

Returns

ParserEntity[]

gt(x: ParserEntity): booleanMethod

Tests whether every value is greater than its corresponding value.

Parameters

NameTypeDescription
xParserEntityValue to compare.

Returns

boolean

gte(x: ParserEntity): booleanMethod

Tests component-wise greater-than-or-equal comparison.

Parameters

NameTypeDescription
xParserEntityValue to compare.

Returns

boolean

isCollection(obj: unknown): objMethod

Returns whether a value is a Collection.

Parameters

NameTypeDescription
objunknownValue to test.

Returns

obj

isEnumerable: booleanProperty

Indicates that parser operations may be applied to each element.

lt(x: ParserEntity): booleanMethod

Tests whether every value is less than its corresponding value.

Parameters

NameTypeDescription
xParserEntityValue to compare.

Returns

boolean

lte(x: ParserEntity): booleanMethod

Tests component-wise less-than-or-equal comparison.

Parameters

NameTypeDescription
xParserEntityValue to compare.

Returns

boolean

precision: numberProperty

Precision metadata when the collection carries an approximate result.

text(): stringMethod

Returns the collection in Nerdamer notation.

Returns

string

toArray(): ParserEntity[]Method

Returns a new array containing the stored entity references in insertion order.

Returns

ParserEntity[]

toString(): stringMethod

No description is available yet.

Returns

string