8000 Ensure `_.pick` supports path arrays. [closes #2809] · lodash/lodash@ce09384 · GitHub
[go: up one dir, main page]

Skip to content

Commit ce09384

Browse files
committed
Ensure _.pick supports path arrays. [closes #2809]
1 parent 102c5f0 commit ce09384

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

lodash.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13529,7 +13529,7 @@
1352913529
* // => { 'a': 1, 'c': 3 }
1353013530
*/
1353113531
var pick = flatRest(function(object, paths) {
13532-
return object == null ? {} : basePick(object, arrayMap(paths, toKey));
13532+
return object == null ? {} : basePick(object, paths);
1353313533
});
1353413534

1353513535
/**

test/test.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -17597,6 +17597,15 @@
1759717597
assert.deepEqual(_.pick(nested, 'b.c'), { 'b': { 'c': 2 } });
1759817598
});
1759917599

17600+
QUnit.test('should support path arrays', function(assert) {
17601+
assert.expect(1);
17602+
17603+
var object = { 'a.b.c': 1 },
17604+
actual = _.pick(object, [['a.b.c']]);
17605+
17606+
assert.deepEqual(actual, { 'a.b.c': 1 });
17607+
});
17608+
1760017609
QUnit.test('should coerce property names to strings', function(assert) {
1760117610
assert.expect(1);
1760217611

@@ -23585,7 +23594,7 @@
2358523594
});
2358623595
});
2358723596

23588-
QUnit.test('should a new path array', function(assert) {
23597+
QUnit.test('should return new path array', function(assert) {
2358923598
assert.expect(1);
2359023599

2359123600
assert.notStrictEqual(_.toPath('a.b.c'), _.toPath('a.b.c'));

0 commit comments

Comments
 (0)
0