Created
March 31, 2022 20:29
-
-
Save Keraito/a8bea700ebb3332733213ce66d420e46 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hasOwnProperty from './hasOwnProperty'; | |
function shallowEqual(objA: mixed, objB: mixed): boolean { | |
// ... | |
// Test for A's keys different from B. | |
for (let i = 0; i < keysA.length; i++) { | |
const currentKey = keysA[i]; | |
if ( | |
!hasOwnProperty.call(objB, currentKey) || | |
!is(objA[currentKey], objB[currentKey]) | |
) { | |
return false; | |
} | |
} | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment