_baseIsEqual.js 1019 B

12345678910111213141516171819202122232425262728
  1. var baseIsEqualDeep = require('./_baseIsEqualDeep'),
  2. isObjectLike = require('./isObjectLike');
  3. /**
  4. * The base implementation of `_.isEqual` which supports partial comparisons
  5. * and tracks traversed objects.
  6. *
  7. * @private
  8. * @param {*} value The value to compare.
  9. * @param {*} other The other value to compare.
  10. * @param {boolean} bitmask The bitmask flags.
  11. * 1 - Unordered comparison
  12. * 2 - Partial comparison
  13. * @param {Function} [customizer] The function to customize comparisons.
  14. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  15. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  16. */
  17. function baseIsEqual(value, other, bitmask, customizer, stack) {
  18. if (value === other) {
  19. return true;
  20. }
  21. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  22. return value !== value && other !== other;
  23. }
  24. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  25. }
  26. module.exports = baseIsEqual;