NuclearDispersionSystem/ant-design-vue-jeecg/node_modules/@antv/util/lib/is-equal-with.js
2023-09-14 14:47:11 +08:00

33 lines
875 B
JavaScript

var isFunction = require('./type/is-function');
var isEqual = require('./is-equal');
/**
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @param {Function} [fn] The function to customize comparisons.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* @example
*
* function isGreeting(value) {
* return /^h(?:i|ello)$/.test(value);
* }
*
* function customizer(objValue, othValue) {
* if (isGreeting(objValue) && isGreeting(othValue)) {
* return true;
* }
* }
*
* var array = ['hello', 'goodbye'];
* var other = ['hi', 'goodbye'];
*
* isEqualWith(array, other, customizer); // => true
*/
var isEqualWith = function isEqualWith(value, other, fn) {
if (!isFunction(fn)) {
return isEqual(value, other);
}
return !!fn(value, other);
};
module.exports = isEqualWith;