MCPcopy Create free account
hub / github.com/reactjs/react-rails / shallowEqual

Function shallowEqual

lib/assets/react-source/development/react.js:13258–13282  ·  view source on GitHub ↗

* Performs equality by iterating through keys on an object and returning false * when any key has values which are not strictly equal between the arguments. * Returns true when the values of all keys are strictly equal.

(objA, objB)

Source from the content-addressed store, hash-verified

13256 */
13257
13258 function shallowEqual(objA, objB) {
13259 if (objectIs(objA, objB)) {
13260 return true;
13261 }
13262
13263 if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
13264 return false;
13265 }
13266
13267 var keysA = Object.keys(objA);
13268 var keysB = Object.keys(objB);
13269
13270 if (keysA.length !== keysB.length) {
13271 return false;
13272 } // Test for A's keys different from B.
13273
13274
13275 for (var i = 0; i < keysA.length; i++) {
13276 if (!hasOwnProperty$2.call(objB, keysA[i]) || !objectIs(objA[keysA[i]], objB[keysA[i]])) {
13277 return false;
13278 }
13279 }
13280
13281 return true;
13282 }
13283
13284 var skipSelectionChangeEvent = canUseDOM && 'documentMode' in document && document.documentMode <= 11;
13285 var eventTypes$3 = {

Callers 3

constructSelectEventFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected