codetrix - v1.5.0
    Preparing search index...

    Function pick

    • Creates a new object composed of selected keys from the original object.

      Type Parameters

      • T extends object
      • K extends string | number | symbol

      Parameters

      • obj: T

        The source object.

      • keys: K[]

        The keys to pick.

      Returns Pick<T, K>

      A new object with only the picked keys.

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