1 var SetCache = require(
'./_SetCache'),
2 arraySome = require(
'./_arraySome'),
3 cacheHas = require(
'./_cacheHas');
6 var COMPARE_PARTIAL_FLAG = 1,
7 COMPARE_UNORDERED_FLAG = 2;
22 function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
23 var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
24 arrLength = array.length,
25 othLength = other.length;
27 if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
31 var stacked = stack.get(array);
32 if (stacked && stack.get(other)) {
33 return stacked == other;
37 seen = (bitmask & COMPARE_UNORDERED_FLAG) ?
new SetCache : undefined;
39 stack.set(array, other);
40 stack.set(other, array);
43 while (++index < arrLength) {
44 var arrValue = array[index],
45 othValue = other[index];
48 var compared = isPartial
49 ? customizer(othValue, arrValue, index, other, array, stack)
50 : customizer(arrValue, othValue, index, array, other, stack);
52 if (compared !== undefined) {
61 if (!arraySome(other,
function(othValue, othIndex) {
62 if (!cacheHas(seen, othIndex) &&
63 (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
64 return seen.push(othIndex);
71 arrValue === othValue ||
72 equalFunc(arrValue, othValue, bitmask, customizer, stack)
78 stack[
'delete'](array);
79 stack[
'delete'](other);
83 module.exports = equalArrays;