MCPcopy Index your code
hub / github.com/krasimir/react-in-patterns / shallowEqual

Function shallowEqual

code/new-context-api/public/app.js:574–598  ·  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

572 * Returns true when the values of all keys are strictly equal.
573 */
574function shallowEqual(objA, objB) {
575 if (is(objA, objB)) {
576 return true;
577 }
578
579 if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
580 return false;
581 }
582
583 var keysA = Object.keys(objA);
584 var keysB = Object.keys(objB);
585
586 if (keysA.length !== keysB.length) {
587 return false;
588 }
589
590 // Test for A's keys different from B.
591 for (var i = 0; i < keysA.length; i++) {
592 if (!hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
593 return false;
594 }
595 }
596
597 return true;
598}
599
600module.exports = shallowEqual;
601},{}],18:[function(require,module,exports){

Callers 2

constructSelectEventFunction · 0.70

Calls 1

isFunction · 0.70

Tested by

no test coverage detected