• Groups input by a function and maintains a separate index for each group.

    Type Parameters

    • In

    • Out

    • Group extends string | number

    • Inner extends Index<In, Out, Inner>

    Parameters

    • f: ((_) => Group)
        • (_): Group
        • Parameters

          • _: In

          Returns Group

    • inner: UnregisteredIndex<In, Out, Inner>

    Returns UnregisteredIndex<In, Out, GroupedIndex<In, Out, Group, Inner>>

    Example

    const collection = new Collection<Readonly<{ 
    name: string,
    team: string,
    }>>();

    const ixTeamSizes = collection.registerIndex(
    group(
    (p) => p.team,
    countIndex()
    )
    );

    console.log(ixTeamSizes.get("Team One")?.value)

Generated using TypeDoc