eq.cjs 839 B

123456789101112131415161718192021222324252627282930313233343536
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. /**
  4. * Performs a
  5. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  6. * comparison between two values to determine if they are equivalent.
  7. *
  8. * @since 4.0.0
  9. * @category Lang
  10. * @param {*} value The value to compare.
  11. * @param {*} other The other value to compare.
  12. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  13. * @example
  14. *
  15. * const object = { 'a': 1 }
  16. * const other = { 'a': 1 }
  17. *
  18. * eq(object, object)
  19. * // => true
  20. *
  21. * eq(object, other)
  22. * // => false
  23. *
  24. * eq('a', 'a')
  25. * // => true
  26. *
  27. * eq('a', Object('a'))
  28. * // => false
  29. *
  30. * eq(NaN, NaN)
  31. * // => true
  32. */
  33. function eq(value, other) {
  34. return value === other || (value !== value && other !== other);
  35. }
  36. exports.default = eq;