@welldone-software/why-did-you-render
Advanced tools
Comparing version 6.0.5 to 6.1.0
/** | ||
* @welldone-software/why-did-you-render 6.0.5 | ||
* @welldone-software/why-did-you-render 6.1.0 | ||
* MIT Licensed | ||
* Generated by Vitali Zaidman <vzaidman@gmail.com> (https://github.com/vzaidman) | ||
* Generated at 2020-12-30 | ||
* Generated at 2021-03-06 | ||
*/ | ||
@@ -62,2 +62,18 @@ | ||
function _typeof(obj) { | ||
"@babel/helpers - typeof"; | ||
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { | ||
_typeof = function (obj) { | ||
return typeof obj; | ||
}; | ||
} else { | ||
_typeof = function (obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}; | ||
} | ||
return _typeof(obj); | ||
} | ||
function _classCallCheck(instance, Constructor) { | ||
@@ -526,13 +542,20 @@ if (!(instance instanceof Constructor)) { | ||
if (lodash.isPlainObject(a) && lodash.isPlainObject(b)) { | ||
var keys = lodash.keys(a); | ||
var keysLength = keys.length; | ||
if (_typeof(a) === 'object' && _typeof(b) === 'object' && Object.getPrototypeOf(a) === Object.getPrototypeOf(b)) { | ||
var allKeys = Object.getOwnPropertyNames(a); | ||
var clonedA = lodash.isPlainObject(a) ? _objectSpread2({}, a) : a; | ||
var clonedB = lodash.isPlainObject(b) ? _objectSpread2({}, b) : b; | ||
if (keysLength !== lodash.keys(b).length) { | ||
return trackDiff(_objectSpread2({}, a), _objectSpread2({}, b), diffsAccumulator, pathString, diffTypes.different); | ||
} | ||
if (allKeys.length !== Object.getOwnPropertyNames(b).length) { | ||
return trackDiff(clonedA, clonedB, diffsAccumulator, pathString, diffTypes.different); | ||
} // Do not compare the stack as it might differ even though the errors are identical. | ||
var relevantKeys = lodash.isError(a) ? allKeys.filter(function (k) { | ||
return k !== 'stack'; | ||
}) : allKeys; | ||
var keysLength = relevantKeys.length; | ||
for (var _i = keysLength; _i--; _i > 0) { | ||
if (!lodash.has(b, keys[_i])) { | ||
return trackDiff(_objectSpread2({}, a), _objectSpread2({}, b), diffsAccumulator, pathString, diffTypes.different); | ||
if (!lodash.has(b, relevantKeys[_i])) { | ||
return trackDiff(clonedA, clonedB, diffsAccumulator, pathString, diffTypes.different); | ||
} | ||
@@ -545,3 +568,3 @@ } | ||
for (var _i2 = keysLength; _i2--; _i2 > 0) { | ||
var key = keys[_i2]; | ||
var key = relevantKeys[_i2]; | ||
var deepEquals = accumulateDeepEqualDiffs(a[key], b[key], objectValuesDiffs, "".concat(pathString, ".").concat(key), { | ||
@@ -561,6 +584,6 @@ detailed: detailed | ||
if (numberOfDeepEqualsObjectValues === keysLength) { | ||
return trackDiff(_objectSpread2({}, a), _objectSpread2({}, b), diffsAccumulator, pathString, diffTypes.deepEquals); | ||
return trackDiff(clonedA, clonedB, diffsAccumulator, pathString, diffTypes.deepEquals); | ||
} | ||
return trackDiff(_objectSpread2({}, a), _objectSpread2({}, b), diffsAccumulator, pathString, diffTypes.different); | ||
return trackDiff(clonedA, clonedB, diffsAccumulator, pathString, diffTypes.different); | ||
} | ||
@@ -567,0 +590,0 @@ |
{ | ||
"name": "@welldone-software/why-did-you-render", | ||
"version": "6.0.5", | ||
"version": "6.1.0", | ||
"description": "Monkey patches React to notify you about avoidable re-renders.", | ||
@@ -5,0 +5,0 @@ "types": "types.d.ts", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
160924
1398