1 var baseIsEqual = require('./_baseIsEqual');
4 * This method is like `_.isEqual` except that it accepts `customizer` which
5 * is invoked to compare values. If `customizer` returns `undefined`, comparisons
6 * are handled by the method instead. The `customizer` is invoked with up to
7 * six arguments: (objValue, othValue [, index|key, object, other, stack]).
13 * @param {*} value The value to compare.
14 * @param {*} other The other value to compare.
15 * @param {Function} [customizer] The function to customize comparisons.
16 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
19 * function isGreeting(value) {
20 * return /^h(?:i|ello)$/.test(value);
23 * function customizer(objValue, othValue) {
24 * if (isGreeting(objValue) && isGreeting(othValue)) {
29 * var array = ['hello', 'goodbye'];
30 * var other = ['hi', 'goodbye'];
32 * _.isEqualWith(array, other, customizer);
35 function isEqualWith(value, other, customizer) {
36 customizer = typeof customizer == 'function' ? customizer : undefined;
37 var result = customizer ? customizer(value, other) : undefined;
38 return result === undefined ? baseIsEqual(value, other, customizer) : !!result;
41 module.exports = isEqualWith;