File tree 2 files changed +19
-1
lines changed 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change 13551
13551
* // => { 'a': 1, 'c': 3 }
13552
13552
*/
13553
13553
function pickBy(object, predicate) {
13554
- return object == null ? {} : basePickBy(object, getAllKeysIn(object), getIteratee(predicate));
13554
+ if (object == null) {
13555
+ return {};
13556
+ }
13557
+ var props = arrayMap(getAllKeysIn(object), function(prop) {
13558
+ return [prop];
13559
+ });
13560
+ predicate = getIteratee(predicate);
13561
+ return basePickBy(object, props, function(value, path) {
13562
+ return predicate(value, path[0]);
13563
+ });
13555
13564
}
13556
13565
13557
13566
/**
Original file line number Diff line number Diff line change 17640
17640
17641
17641
assert.deepEqual(actual, { 'a': 1, 'c': 3 });
17642
17642
});
17643
+
17644
+ QUnit.test('should not treat keys with dots as deep paths', function(assert) {
17645
+ assert.expect(1);
17646
+
17647
+ var object = { 'a.b.c': 1 },
17648
+ actual = _.pickBy(object, stubTrue);
17649
+
17650
+ assert.deepEqual(actual, { 'a.b.c': 1 });
17651
+ });
17643
17652
}());
17644
17653
17645
17654
/*--------------------------------------------------------------------------*/
You can’t perform that action at this time.
0 commit comments