Function pick

  • Creates an object composed of the picked object properties.

    Returns

    A new object with the properties.

    Example

    let object = { a: 1, b: '2', c: 3 }

    pick(object, ['a', 'c'])
    // { a: 1, c: 3 }

    pick(object, (x) => isNumber(x))
    // { a: 1, c: 3 }

    See

    omit

    Type Parameters

    • T

    Parameters

    • obj: T

      The source object.

    • paths: Iteratee<any, any, any>

      The properties to pick. If paths is a function, it will be invoked per property with two values (value, key).

    Returns Partial<T>

  • Type Parameters

    • T

    Parameters

    • obj: T
    • paths: PropertyKey[]

    Returns Partial<T>

Generated using TypeDoc