* A specialized version of `baseIsEqualDeep` for arrays with support for * partial deep comparisons. * * @private * @param {Array} array The array to compare. * @param {Array} other The other array to compare. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. *
(array, other, bitmask, customizer, equalFunc, stack)
| 15383 | * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. |
| 15384 | */ |
| 15385 | function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { |
| 15386 | var isPartial = bitmask & COMPARE_PARTIAL_FLAG, |
| 15387 | arrLength = array.length, |
| 15388 | othLength = other.length; |
| 15389 | |
| 15390 | if (arrLength != othLength && !(isPartial && othLength > arrLength)) { |
| 15391 | return false; |
| 15392 | } |
| 15393 | // Check that cyclic values are equal. |
| 15394 | var arrStacked = stack.get(array); |
| 15395 | var othStacked = stack.get(other); |
| 15396 | if (arrStacked && othStacked) { |
| 15397 | return arrStacked == other && othStacked == array; |
| 15398 | } |
| 15399 | var index = -1, |
| 15400 | result = true, |
| 15401 | seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined; |
| 15402 | |
| 15403 | stack.set(array, other); |
| 15404 | stack.set(other, array); |
| 15405 | |
| 15406 | // Ignore non-index properties. |
| 15407 | while (++index < arrLength) { |
| 15408 | var arrValue = array[index], |
| 15409 | othValue = other[index]; |
| 15410 | |
| 15411 | if (customizer) { |
| 15412 | var compared = isPartial |
| 15413 | ? customizer(othValue, arrValue, index, other, array, stack) |
| 15414 | : customizer(arrValue, othValue, index, array, other, stack); |
| 15415 | } |
| 15416 | if (compared !== undefined) { |
| 15417 | if (compared) { |
| 15418 | continue; |
| 15419 | } |
| 15420 | result = false; |
| 15421 | break; |
| 15422 | } |
| 15423 | // Recursively compare arrays (susceptible to call stack limits). |
| 15424 | if (seen) { |
| 15425 | if (!arraySome(other, function(othValue, othIndex) { |
| 15426 | if (!cacheHas(seen, othIndex) && |
| 15427 | (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { |
| 15428 | return seen.push(othIndex); |
| 15429 | } |
| 15430 | })) { |
| 15431 | result = false; |
| 15432 | break; |
| 15433 | } |
| 15434 | } else if (!( |
| 15435 | arrValue === othValue || |
| 15436 | equalFunc(arrValue, othValue, bitmask, customizer, stack) |
| 15437 | )) { |
| 15438 | result = false; |
| 15439 | break; |
| 15440 | } |
| 15441 | } |
| 15442 | stack['delete'](array); |
no test coverage detected
searching dependent graphs…