mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 19:07:49 +00:00
Ensure _.pickBy doesn’t treat keys with dots as deep paths. [closes #2808]
This commit is contained in:
11
lodash.js
11
lodash.js
@@ -13551,7 +13551,16 @@
|
||||
* // => { 'a': 1, 'c': 3 }
|
||||
*/
|
||||
function pickBy(object, predicate) {
|
||||
return object == null ? {} : basePickBy(object, getAllKeysIn(object), getIteratee(predicate));
|
||||
if (object == null) {
|
||||
return {};
|
||||
}
|
||||
var props = arrayMap(getAllKeysIn(object), function(prop) {
|
||||
return [prop];
|
||||
});
|
||||
predicate = getIteratee(predicate);
|
||||
return basePickBy(object, props, function(value, path) {
|
||||
return predicate(value, path[0]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user