Skip to content

Instantly share code, notes, and snippets.

@Keraito
Created March 31, 2022 20:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Keraito/a8bea700ebb3332733213ce66d420e46 to your computer and use it in GitHub Desktop.
Save Keraito/a8bea700ebb3332733213ce66d420e46 to your computer and use it in GitHub Desktop.
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