Function keyBy

  • Creates an object composed of keys generated from the results of running each element of collection through iteratee. The corresponding value of each key is the last element responsible for generating the key. The iteratee function is invoked with one argument: (value).

    Type Parameters

    • T

    Parameters

    • collection: Nullable<ArrayLike<T>>

      The collection to iterate over.

    • Optionaliteratee: ValueIterateeCustom<T, PropertyKey>

      The function invoked per iteration.

    Returns Dictionary<T>

  • Type Parameters

    • T extends object

    Parameters

    • collection: Nullable<T>
    • Optionaliteratee: ValueIterateeCustom<T[keyof T], PropertyKey>

    Returns Dictionary<T[keyof T]>

    keyBy