Function pluck

  • Extracts an array of values from an array of objects, based on a given key.

    Returns

    an array of values extracted from the objects in the input array

    Throws

    an error if a key is not found in an object

    Type Parameters

    • T

    • K extends string | number | symbol

    Parameters

    • array: T[]

      the input array

    • key: K

      the key to extract values from objects in the array

    Returns T[K][]

Generated using TypeDoc