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

Function shallowEqual

code/composition/public/app.js:711–735  ·  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

709 * Returns true when the values of all keys are strictly equal.
710 */
711function shallowEqual(objA, objB) {
712 if (is(objA, objB)) {
713 return true;
714 }
715
716 if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
717 return false;
718 }
719
720 var keysA = Object.keys(objA);
721 var keysB = Object.keys(objB);
722
723 if (keysA.length !== keysB.length) {
724 return false;
725 }
726
727 // Test for A's keys different from B.
728 for (var i = 0; i < keysA.length; i++) {
729 if (!hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
730 return false;
731 }
732 }
733
734 return true;
735}
736
737module.exports = shallowEqual;
738},{}],17:[function(require,module,exports){

Callers 2

constructSelectEventFunction · 0.70

Calls 1

isFunction · 0.70

Tested by

no test coverage detected