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