Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Fields

Collection of Field entries mapped by name.

Hierarchy

  • Fields

Index

Constructors

constructor

  • new Fields(__namedParameters: { encoding: undefined | string; fields: undefined | Field[] }): Fields
  • Parameters

    • __namedParameters: { encoding: undefined | string; fields: undefined | Field[] }
      • encoding: undefined | string
      • fields: undefined | Field[]

    Returns Fields

Methods

getAll

  • Retrieves all the Fields in the collection. Includes headers and trailers.

    Returns Field[]

    All fields in the collection.

getByType

  • Helper function for retrieving specific types of fields. Used to grab all headers or all trailers.

    Parameters

    Returns Field[]

    The Field entries with the specified FieldPosition.

getField

  • getField(name: string): Field | undefined
  • Retrieve Field entry by name.

    Parameters

    • name: string

      The name of the Field entry to retrieve

    Returns Field | undefined

    The Field if it exists.

removeField

  • removeField(name: string): void
  • Delete entry from collection.

    Parameters

    • name: string

      Name of the entry to delete.

    Returns void

setField

  • setField(field: Field): void
  • Set entry for a Field name. The name attribute will be used to key the collection.

    Parameters

    Returns void

Static from

  • Utility for creating Fields without having to construct each Field individually.

    Parameters

    • fieldsToCreate: FieldOptions[]

      List of arguments used to create each Field.

    • Optional encoding: undefined | string

      Optional encoding of resultant Fields.

    Returns Fields

    The Fields instance.