Add props param to basePickBy.

This commit is contained in:
John-David Dalton
2016-07-23 20:48:07 -07:00
parent d459f4ac7c
commit 80dbd4cbfa

View File

@@ -3470,12 +3470,9 @@
*/
function basePick(object, props) {
object = Object(object);
return arrayReduce(props, function(result, key) {
if (key in object) {
result[key] = object[key];
}
return result;
}, {});
return basePickBy(object, props, function(value, key) {
return key in object;
});
}
/**
@@ -3483,12 +3480,12 @@
*
* @private
* @param {Object} object The source object.
* @param {string[]} props The property identifiers to pick from.
* @param {Function} predicate The function invoked per property.
* @returns {Object} Returns the new object.
*/
function basePickBy(object, predicate) {
function basePickBy(object, props, predicate) {
var index = -1,
props = getAllKeysIn(object),
length = props.length,
result = {};
@@ -13035,10 +13032,7 @@
* // => { 'b': '2' }
*/
function omitBy(object, predicate) {
predicate = getIteratee(predicate);
return basePickBy(object, function(value, key) {
return !predicate(value, key);
});
return pickBy(object, negate(getIteratee(predicate)));
}
/**
@@ -13081,7 +13075,7 @@
* // => { 'a': 1, 'c': 3 }
*/
function pickBy(object, predicate) {
return object == null ? {} : basePickBy(object, getIteratee(predicate));
return object == null ? {} : basePickBy(object, getAllKeysIn(object), getIteratee(predicate));
}
/**