Function indexBy

  • Similer to groupBy, but only matches a single object for each key.

    Returns

    an object mapping the keys to the individual objects

    Type Parameters

    • T extends Record<string | symbol, any>

    • K extends string | number | symbol

    • TK extends any

    Parameters

    • array: T[]

      an array of objects

    • key: K

      the object key by which to index

    Returns Record<TK, T>

Generated using TypeDoc