1 var baseIsEqual = require('./_baseIsEqual');
4 * This method is like `_.isEqual` except that it accepts `customizer` which is
5 * invoked to compare values. If `customizer` returns `undefined` comparisons are
6 * handled by the method instead. The `customizer` is invoked with up to six arguments:
7 * (objValue, othValue [, index|key, object, other, stack]).
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`.
18 * function isGreeting(value) {
19 * return /^h(?:i|ello)$/.test(value);
22 * function customizer(objValue, othValue) {
23 * if (isGreeting(objValue) && isGreeting(othValue)) {
28 * var array = ['hello', 'goodbye'];
29 * var other = ['hi', 'goodbye'];
31 * _.isEqualWith(array, other, customizer);
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, customizer) : !!result;
40 module.exports = isEqualWith;