Sha256: 38124beafb9a3a8b6ee5f9547829ef5d2ae3ee3ab61a4724f714b6d1a6e11da4

Contents?: true

Size: 1.76 KB

Versions: 153

Compression:

Stored size: 1.76 KB

Contents

var arraySome = require('./arraySome');

/**
 * 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 {Function} equalFunc The function to determine equivalents of values.
 * @param {Function} [customizer] The function to customize comparing arrays.
 * @param {boolean} [isLoose] Specify performing partial comparisons.
 * @param {Array} [stackA] Tracks traversed `value` objects.
 * @param {Array} [stackB] Tracks traversed `other` objects.
 * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
 */
function equalArrays(array, other, equalFunc, customizer, isLoose, stackA, stackB) {
  var index = -1,
      arrLength = array.length,
      othLength = other.length;

  if (arrLength != othLength && !(isLoose && othLength > arrLength)) {
    return false;
  }
  // Ignore non-index properties.
  while (++index < arrLength) {
    var arrValue = array[index],
        othValue = other[index],
        result = customizer ? customizer(isLoose ? othValue : arrValue, isLoose ? arrValue : othValue, index) : undefined;

    if (result !== undefined) {
      if (result) {
        continue;
      }
      return false;
    }
    // Recursively compare arrays (susceptible to call stack limits).
    if (isLoose) {
      if (!arraySome(other, function(othValue) {
            return arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB);
          })) {
        return false;
      }
    } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB))) {
      return false;
    }
  }
  return true;
}

module.exports = equalArrays;

Version data entries

153 entries across 80 versions & 8 rubygems

Version Path
ilog-0.4.1 node_modules/contents/node_modules/lodash/internal/equalArrays.js
ilog-0.4.1 node_modules/babel-plugin-proto-to-assign/node_modules/lodash/internal/equalArrays.js
ilog-0.4.1 node_modules/babel/node_modules/lodash/internal/equalArrays.js
ilog-0.4.0 node_modules/babel/node_modules/lodash/internal/equalArrays.js
ilog-0.4.0 node_modules/contents/node_modules/lodash/internal/equalArrays.js
ilog-0.4.0 node_modules/babel-plugin-proto-to-assign/node_modules/lodash/internal/equalArrays.js
ilog-0.3.3 node_modules/babel/node_modules/lodash/internal/equalArrays.js
ilog-0.3.3 node_modules/contents/node_modules/lodash/internal/equalArrays.js
ilog-0.3.3 node_modules/babel-plugin-proto-to-assign/node_modules/lodash/internal/equalArrays.js
trusty-festivity-extension-2.6.3 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/equalArrays.js
trusty-festivity-extension-2.6.3 node_modules/bower/node_modules/inquirer/node_modules/lodash/internal/equalArrays.js
trusty-festivity-extension-2.6.2 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/equalArrays.js
trusty-festivity-extension-2.6.2 node_modules/bower/node_modules/inquirer/node_modules/lodash/internal/equalArrays.js
trusty-festivity-extension-2.6.1 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/equalArrays.js
trusty-festivity-extension-2.6.1 node_modules/bower/node_modules/inquirer/node_modules/lodash/internal/equalArrays.js
xcodebuild-helper-1.2.5 externals/ios-sim-master/node_modules/lodash/internal/equalArrays.js
trusty-festivity-extension-2.6 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/equalArrays.js
trusty-festivity-extension-2.6 node_modules/bower/node_modules/inquirer/node_modules/lodash/internal/equalArrays.js
trusty-festivity-extension-2.5.19 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/internal/equalArrays.js
trusty-festivity-extension-2.5.19 node_modules/bower/node_modules/inquirer/node_modules/lodash/internal/equalArrays.js