is-equal-with.js 986 B

123456789101112131415161718192021222324252627282930313233
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. var is_function_1 = require("./is-function");
  4. var is_equal_1 = require("./is-equal");
  5. /**
  6. * @param {*} value The value to compare.
  7. * @param {*} other The other value to compare.
  8. * @param {Function} [fn] The function to customize comparisons.
  9. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  10. * @example
  11. *
  12. * function isGreeting(value) {
  13. * return /^h(?:i|ello)$/.test(value);
  14. * }
  15. *
  16. * function customizer(objValue, othValue) {
  17. * if (isGreeting(objValue) && isGreeting(othValue)) {
  18. * return true;
  19. * }
  20. * }
  21. *
  22. * var array = ['hello', 'goodbye'];
  23. * var other = ['hi', 'goodbye'];
  24. *
  25. * isEqualWith(array, other, customizer); // => true
  26. */
  27. exports.default = (function (value, other, fn) {
  28. if (!is_function_1.default(fn)) {
  29. return is_equal_1.default(value, other);
  30. }
  31. return !!fn(value, other);
  32. });
  33. //# sourceMappingURL=is-equal-with.js.map