Make _.where search arrays for values.

Former-commit-id: b942c6a44680c78fae1a41f2cf994be09ffcfbb9
This commit is contained in:
John-David Dalton
2013-02-16 00:39:45 -08:00
parent 9ccfa5cec9
commit 2a2bc44f43
7 changed files with 181 additions and 140 deletions

View File

@@ -2607,6 +2607,14 @@
deepEqual(_.where(collection, { 'a': { 'b': { 'c': 1 } } }), expected);
});
test('should search of arrays for values', function() {
var collection = [{ 'a': [1, 2] }],
expected = _.cloneDeep(collection);
deepEqual(_.where(collection, { 'a': [] }), []);
deepEqual(_.where(collection, { 'a': [2] }), expected);
});
}());
/*--------------------------------------------------------------------------*/