Ohm-Management - Projektarbeit B-ME
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.

isEqualWith.js 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. var baseIsEqual = require('./_baseIsEqual');
  2. /**
  3. * This method is like `_.isEqual` except that it accepts `customizer` which
  4. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  5. * are handled by the method instead. The `customizer` is invoked with up to
  6. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  7. *
  8. * @static
  9. * @memberOf _
  10. * @since 4.0.0
  11. * @category Lang
  12. * @param {*} value The value to compare.
  13. * @param {*} other The other value to compare.
  14. * @param {Function} [customizer] The function to customize comparisons.
  15. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  16. * @example
  17. *
  18. * function isGreeting(value) {
  19. * return /^h(?:i|ello)$/.test(value);
  20. * }
  21. *
  22. * function customizer(objValue, othValue) {
  23. * if (isGreeting(objValue) && isGreeting(othValue)) {
  24. * return true;
  25. * }
  26. * }
  27. *
  28. * var array = ['hello', 'goodbye'];
  29. * var other = ['hi', 'goodbye'];
  30. *
  31. * _.isEqualWith(array, other, customizer);
  32. * // => true
  33. */
  34. function isEqualWith(value, other, customizer) {
  35. customizer = typeof customizer == 'function' ? customizer : undefined;
  36. var result = customizer ? customizer(value, other) : undefined;
  37. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  38. }
  39. module.exports = isEqualWith;