* 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 `baseIsEqua
(array, other, bitmask, customizer, equalFunc, stack)
| 5704 | * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. |
| 5705 | */ |
| 5706 | function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { |
| 5707 | var isPartial = bitmask & COMPARE_PARTIAL_FLAG, |
| 5708 | arrLength = array.length, |
| 5709 | othLength = other.length; |
| 5710 | |
| 5711 | if (arrLength != othLength && !(isPartial && othLength > arrLength)) { |
| 5712 | return false; |
| 5713 | } |
| 5714 | // Check that cyclic values are equal. |
| 5715 | var arrStacked = stack.get(array); |
| 5716 | var othStacked = stack.get(other); |
| 5717 | if (arrStacked && othStacked) { |
| 5718 | return arrStacked == other && othStacked == array; |
| 5719 | } |
| 5720 | var index = -1, |
| 5721 | result = true, |
| 5722 | seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined; |
| 5723 | |
| 5724 | stack.set(array, other); |
| 5725 | stack.set(other, array); |
| 5726 | |
| 5727 | // Ignore non-index properties. |
| 5728 | while (++index < arrLength) { |
| 5729 | var arrValue = array[index], |
| 5730 | othValue = other[index]; |
| 5731 | |
| 5732 | if (customizer) { |
| 5733 | var compared = isPartial |
| 5734 | ? customizer(othValue, arrValue, index, other, array, stack) |
| 5735 | : customizer(arrValue, othValue, index, array, other, stack); |
| 5736 | } |
| 5737 | if (compared !== undefined) { |
| 5738 | if (compared) { |
| 5739 | continue; |
| 5740 | } |
| 5741 | result = false; |
| 5742 | break; |
| 5743 | } |
| 5744 | // Recursively compare arrays (susceptible to call stack limits). |
| 5745 | if (seen) { |
| 5746 | if (!arraySome(other, function(othValue, othIndex) { |
| 5747 | if (!cacheHas(seen, othIndex) && |
| 5748 | (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { |
| 5749 | return seen.push(othIndex); |
| 5750 | } |
| 5751 | })) { |
| 5752 | result = false; |
| 5753 | break; |
| 5754 | } |
| 5755 | } else if (!( |
| 5756 | arrValue === othValue || |
| 5757 | equalFunc(arrValue, othValue, bitmask, customizer, stack) |
| 5758 | )) { |
| 5759 | result = false; |
| 5760 | break; |
| 5761 | } |
| 5762 | } |
| 5763 | stack['delete'](array); |
no test coverage detected