diff --git a/lodash.js b/lodash.js index 5db9358e7..8b27a0483 100644 --- a/lodash.js +++ b/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]); + }); } /** diff --git a/test/test.js b/test/test.js index c62c4e84c..50a0a6b93 100644 --- a/test/test.js +++ b/test/test.js @@ -17640,6 +17640,15 @@ assert.deepEqual(actual, { 'a': 1, 'c': 3 }); }); + + QUnit.test('should not treat keys with dots as deep paths', function(assert) { + assert.expect(1); + + var object = { 'a.b.c': 1 }, + actual = _.pickBy(object, stubTrue); + + assert.deepEqual(actual, { 'a.b.c': 1 }); + }); }()); /*--------------------------------------------------------------------------*/