mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
573 B
22 lines
573 B
var baseForIn = require('./baseForIn');
|
|
|
|
/**
|
|
* A specialized version of `_.pick` which picks `object` properties `predicate`
|
|
* returns truthy for.
|
|
*
|
|
* @private
|
|
* @param {Object} object The source object.
|
|
* @param {Function} predicate The function invoked per iteration.
|
|
* @returns {Object} Returns the new object.
|
|
*/
|
|
function pickByCallback(object, predicate) {
|
|
var result = {};
|
|
baseForIn(object, function(value, key, object) {
|
|
if (predicate(value, key, object)) {
|
|
result[key] = value;
|
|
}
|
|
});
|
|
return result;
|
|
}
|
|
|
|
module.exports = pickByCallback;
|
|
|