Library API
    Preparing search index...

    Function pluck

    • Extracts a specified named key from an array of objects.

      Type Parameters

      • T
      • K extends string | number | symbol

      Parameters

      • objs: T[]

        The array of objects

      • key: K

        The property key to extract

      Returns T[K][]

      An array of the extracted property values

      const ids = pluck([{ id: 1 }, { id: 2 }], 'id'); // [1, 2]