Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Grouping<KeyType, RowType>

A companion for the Table data structure when working with grouped data.

Type parameters

  • KeyType

  • RowType

Hierarchy

  • Grouping

Index

Constructors

constructor

  • new Grouping<KeyType, RowType>(data: Map<KeyType, RowType[]>): Grouping<KeyType, RowType>
  • Type parameters

    • KeyType

    • RowType

    Parameters

    • data: Map<KeyType, RowType[]>

    Returns Grouping<KeyType, RowType>

Properties

data

data: Map<KeyType, RowType[]>

Methods

aggregate

  • aggregate<AggType>(aggFunc: (row: RowType[]) => AggType): Table<AggType & { id: KeyType }>
  • Type parameters

    • AggType

    Parameters

    • aggFunc: (row: RowType[]) => AggType
        • (row: RowType[]): AggType
        • Parameters

          • row: RowType[]

          Returns AggType

    Returns Table<AggType & { id: KeyType }>

aggregateByColumn

  • aggregateByColumn<AggFuncsMapType>(aggregations: AggFuncsMapType): Table<ExtractObjectFuncResults<AggFuncsMapType> & { id: KeyType }>
  • Type parameters

    Parameters

    • aggregations: AggFuncsMapType

    Returns Table<ExtractObjectFuncResults<AggFuncsMapType> & { id: KeyType }>

counts

  • counts(): Map<KeyType, number>
  • Aggregates a grouping by returning the number of rows for each key

    Returns Map<KeyType, number>

    a Map of key => count

first

  • first(): Table<NonNullable<RowType & { id: KeyType }>>
  • Aggregates the grouping by returning the first row for each key

    Returns Table<NonNullable<RowType & { id: KeyType }>>

    A Table of the aggregated output

last

  • last(): Table<NonNullable<RowType & { id: KeyType }>>
  • Aggregates the grouping by returning the last row for each key

    Returns Table<NonNullable<RowType & { id: KeyType }>>

    A Table of the aggregated output

Generated using TypeDoc