mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-31 23:37:49 +00:00
Add props param to basePickBy.
This commit is contained in:
20
lodash.js
20
lodash.js
@@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user