Options
All
  • Public
  • Public/Protected
  • All
Menu

Module object/pick

Index

References

Interfaces

Type aliases

Functions

References

Renames and re-exports pick

Type aliases

PickProps<K, O>: Pick<O, Exclude<keyof O, Exclude<keyof O, K>>>

Type parameters

  • K

  • O

Functions

  • pick<K, O>(names: readonly K[], obj: O): PickProps<K, O>
  • pick<K>(names: readonly K[]): <O>(obj: O) => PickProps<K, O>
  • Returns a partial copy of an object containing only the keys specified. If the key does not exist, the property is ignored.

    example
     pick(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1, d: 4}
    pick(['a', 'e', 'f'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1}

    Type parameters

    • K: string | number | symbol

    • O

    Parameters

    • names: readonly K[]
    • obj: O

      The object to copy from

    Returns PickProps<K, O>

    A new object with only properties from names on it.

  • Returns a partial copy of an object containing only the keys specified. If the key does not exist, the property is ignored.

    example
     pick(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1, d: 4}
    pick(['a', 'e', 'f'], {a: 1, b: 2, c: 3, d: 4}); //=> {a: 1}

    Type parameters

    • K: string | number | symbol

    Parameters

    • names: readonly K[]

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

    A new object with only properties from names on it.

Generated using TypeDoc