Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
callback = data => {
const { callback } = this.props;
/* istanbul ignore else */
if (is.function(callback)) {
callback(data);
}
};
const hasReactElement = isValidElement(left) || isValidElement(right);
const hasUndefined = is.undefined(left) || is.undefined(right);
if (getObjectType(left) !== getObjectType(right) || hasReactElement || hasUndefined) {
return false;
}
if (is.domElement(left)) {
return left.isSameNode(right);
}
if (is.number(left)) {
return left === right;
}
if (is.function(left)) {
return left.toString() === right.toString();
}
for (const key in left) {
/* istanbul ignore else */
if (hasOwnProperty(left, key)) {
if (typeof left[key] === 'undefined' || typeof right[key] === 'undefined') {
return false;
}
type = getObjectType(left[key]);
if (['object', 'array'].includes(type) && isEqual(left[key], right[key])) {
continue;
}