pick source npm

_.pick(object, [props])

Creates an object composed of the picked object properties.

Arguments

  1. object (Object)

    The source object.

  2. [props] (...(string|string[])

    The property names to pick, specified individually or in arrays.

Returns (Object)

Returns the new object.

Example

var object = { 'user': 'fred', 'age': 40 };

_.pick(object, 'user');
// => { 'user': 'fred' }