mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 01:57:50 +00:00
Add _.pluck test for undefined properties.
This commit is contained in:
@@ -9514,6 +9514,13 @@
|
|||||||
deepEqual(_.pluck(object, 'length'), [1, 2, 3]);
|
deepEqual(_.pluck(object, 'length'), [1, 2, 3]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('should return `undefined` for undefined properties', 1, function() {
|
||||||
|
var array = [{ 'a': 1 }],
|
||||||
|
actual = [_.pluck(array, 'b'), _.pluck(array, 'c')];
|
||||||
|
|
||||||
|
deepEqual(actual, [[undefined], [undefined]]);
|
||||||
|
});
|
||||||
|
|
||||||
test('should work with nullish elements', 1, function() {
|
test('should work with nullish elements', 1, function() {
|
||||||
var objects = [{ 'a': 1 }, null, undefined, { 'a': 4 }];
|
var objects = [{ 'a': 1 }, null, undefined, { 'a': 4 }];
|
||||||
deepEqual(_.pluck(objects, 'a'), [1, undefined, undefined, 4]);
|
deepEqual(_.pluck(objects, 'a'), [1, undefined, undefined, 4]);
|
||||||
|
|||||||
Reference in New Issue
Block a user