mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 00:57:48 +00:00
Make _.where search arrays for values.
Former-commit-id: b942c6a44680c78fae1a41f2cf994be09ffcfbb9
This commit is contained in:
25
lodash.js
25
lodash.js
@@ -1568,16 +1568,27 @@
|
||||
|
||||
// recursively compare objects and arrays (susceptible to call stack limits)
|
||||
if (isArr) {
|
||||
// compare lengths to determine if a deep comparison is necessary
|
||||
length = a.length;
|
||||
size = b.length;
|
||||
result = whereIndicator || size == a.length;
|
||||
|
||||
if (result) {
|
||||
// deep compare the contents, ignoring non-numeric properties
|
||||
while (size--) {
|
||||
if (!(result = isEqual(a[size], b[size], callback, thisArg, stackA, stackB))) {
|
||||
break;
|
||||
// compare lengths to determine if a deep comparison is necessary
|
||||
result = size == a.length;
|
||||
if (!result && !whereIndicator) {
|
||||
return result;
|
||||
}
|
||||
// deep compare the contents, ignoring non-numeric properties
|
||||
while (size--) {
|
||||
var index = length,
|
||||
value = b[size];
|
||||
|
||||
if (whereIndicator) {
|
||||
while (index--) {
|
||||
if ((result = isEqual(a[index], value, callback, thisArg, stackA, stackB))) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (!(result = isEqual(a[size], value, callback, thisArg, stackA, stackB))) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user