From 5500a86f0b249ade6c2922da5310459a8f823f26 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 9 Dec 2014 23:39:08 -0800 Subject: [PATCH] Add `_.pluck` test for undefined properties. --- test/test.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/test.js b/test/test.js index 9766c0d08..091a5b286 100644 --- a/test/test.js +++ b/test/test.js @@ -9514,6 +9514,13 @@ 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() { var objects = [{ 'a': 1 }, null, undefined, { 'a': 4 }]; deepEqual(_.pluck(objects, 'a'), [1, undefined, undefined, 4]);