pickBy source npm

_.pickBy(object, [predicate=_.identity])

Creates an object composed of the object properties predicate returns truthy for. The predicate is invoked with one argument: (value).

Arguments

  1. object (Object)

    The source object.

  2. [predicate=_.identity] (Function|Object|string)

    The function invoked per property.

Returns (Object)

Returns the new object.

Example

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

_.pickBy(object, _.isNumber);
// => { 'age': 40 }