Function pick

Creates a new object by picking specific properties from an existing object.

pick(['a', 'b'])({ a: 1, b: 2, c: 3 }) // { a: 1, b: 2 }
  • Type Parameters

    • K extends string | number

    Parameters

    • keys: K[]

    Returns (<O>(obj: O) => Pick<O, K>)

      • <O>(obj): Pick<O, K>
      • Type Parameters

        • O extends Record<K, unknown>

        Parameters

        • obj: O

        Returns Pick<O, K>