1 var arraySome = require('./arraySome');
4 * A specialized version of `baseIsEqualDeep` for arrays with support for
5 * partial deep comparisons.
8 * @param {Array} array The array to compare.
9 * @param {Array} other The other array to compare.
10 * @param {Function} equalFunc The function to determine equivalents of values.
11 * @param {Function} [customizer] The function to customize comparing arrays.
12 * @param {boolean} [isLoose] Specify performing partial comparisons.
13 * @param {Array} [stackA] Tracks traversed `value` objects.
14 * @param {Array} [stackB] Tracks traversed `other` objects.
15 * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
17 function equalArrays(array, other, equalFunc, customizer, isLoose, stackA, stackB) {
19 arrLength = array.length,
20 othLength = other.length;
22 if (arrLength != othLength && !(isLoose && othLength > arrLength)) {
25 // Ignore non-index properties.
26 while (++index < arrLength) {
27 var arrValue = array[index],
28 othValue = other[index],
29 result = customizer ? customizer(isLoose ? othValue : arrValue, isLoose ? arrValue : othValue, index) : undefined;
31 if (result !== undefined) {
37 // Recursively compare arrays (susceptible to call stack limits).
39 if (!arraySome(other, function(othValue) {
40 return arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB);
44 } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB))) {
51 module.exports = equalArrays;