mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-05 09:27:49 +00:00
Ensure _.where handles properties with undefined properties. [closes #461]
This commit is contained in:
14
test/test.js
14
test/test.js
@@ -8465,6 +8465,20 @@
|
||||
deepEqual(_.where(collection, { 'a': [] }), []);
|
||||
deepEqual(_.where(collection, { 'a': [2] }), expected);
|
||||
});
|
||||
|
||||
test('should handle `properties` with `undefined` values', 4, function() {
|
||||
var properties = { 'b': undefined };
|
||||
deepEqual(_.where([{ 'a': 1 }, { 'a': 1, 'b': 1 }], properties), []);
|
||||
|
||||
var object = { 'a': 1, 'b': undefined };
|
||||
deepEqual(_.where([object], properties), [object]);
|
||||
|
||||
properties = { 'a': { 'c': undefined } };
|
||||
deepEqual(_.where([{ 'a': { 'b': 1 } }, { 'a':{ 'b':1 , 'c': 1 } }], properties), []);
|
||||
|
||||
object = { 'a': { 'b': 1, 'c': undefined } };
|
||||
deepEqual(_.where([object], properties), [object]);
|
||||
});
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
Reference in New Issue
Block a user