Ensure _.pickBy doesn’t treat keys with dots as deep paths. [closes #2808]

This commit is contained in:
John-David Dalton
2016-11-14 00:47:47 -08:00
parent 13d315a93b
commit 102c5f00d7
2 changed files with 19 additions and 1 deletions

View File

@@ -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]);
});
}
/**