Skip to content

@alex.garcia/libfec / Row

Class: Row<I> ​

Defined in: row.ts:65

One row of a filing after the cover: an itemization (SA11AI, SB17, …), a text record, or a summary row, mirroring Python's libfec_parser.Row.

  • From itemizations(), a row is a Row<Itemization>: itemization is the typed record, narrowed with switch (row.itemization.type).
  • From rows() it is a Row<null>: only the column-keyed values.

All data is in own enumerable properties, so { ...row } and structuredClone(row) give plain objects (without the methods).

Type Parameters ​

I ​

I extends Itemization | null = Itemization | null

Properties ​

rowType ​

readonly rowType: string

Defined in: row.ts:71

The row type as filed, field 0: "SA11AI", "SB17", "TEXT". A TEXT row's first column is named rec_type, not form_type, so test rowType rather than values.form_type.


line ​

readonly line: number

Defined in: row.ts:73

The row's 1-based physical line in the file.


values ​

readonly values: RowValues

Defined in: row.ts:75

The row's values by FEC column name, in column order; see Value.


itemization ​

readonly itemization: I

Defined in: row.ts:84

The row as a typed record, from itemizations(); null from rows().

Values are the parser's: an unparseable amount reads 0 (or null where the field is optional) and an invalid date null, the same as Python's typed classes. values keeps the raw text of such fields and the reader lists them in invalidValues.


fields ​

readonly fields: readonly string[]

Defined in: row.ts:86

Every raw field of the row, in file order.

Accessors ​

extraFields ​

Get Signature ​

get extraFields(): string[]

Defined in: row.ts:107

Fields past the last mapped column; [] unless one of them is non-empty (trailing empty fields are common and meaningless).

Returns ​

string[]

Methods ​

get() ​

get(column): Value | undefined

Defined in: row.ts:113

The value of column, or undefined if the row has no such column.

Parameters ​

column ​

string

Returns ​

Value | undefined


toJSON() ​

toJSON(): RowJSON<I>

Defined in: row.ts:118

{ rowType, line, values, itemization } (fields is left out).

Returns ​

RowJSON<I>