UNPKG

872 BJavaScriptView Raw
1import isFunction from './is-function';
2import isEqual from './is-equal';
3/**
4 * @param {*} value The value to compare.
5 * @param {*} other The other value to compare.
6 * @param {Function} [fn] The function to customize comparisons.
7 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
8 * @example
9 *
10 * function isGreeting(value) {
11 * return /^h(?:i|ello)$/.test(value);
12 * }
13 *
14 * function customizer(objValue, othValue) {
15 * if (isGreeting(objValue) && isGreeting(othValue)) {
16 * return true;
17 * }
18 * }
19 *
20 * var array = ['hello', 'goodbye'];
21 * var other = ['hi', 'goodbye'];
22 *
23 * isEqualWith(array, other, customizer); // => true
24 */
25export default (function (value, other, fn) {
26 if (!isFunction(fn)) {
27 return isEqual(value, other);
28 }
29 return !!fn(value, other);
30});
31//# sourceMappingURL=is-equal-with.js.map
\No newline at end of file