You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
1019 B

пре 3 година
  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;