mirror of
https://github.com/pmndrs/zustand.git
synced 2025-12-08 19:45:52 +00:00
refactor: Use for..of instead of C-style for (#2374)
This commit is contained in:
parent
16b0ebf1b1
commit
41924df88f
@ -37,10 +37,10 @@ export function shallow<T>(objA: T, objB: T) {
|
||||
if (keysA.length !== Object.keys(objB).length) {
|
||||
return false
|
||||
}
|
||||
for (let i = 0; i < keysA.length; i++) {
|
||||
for (const keyA of keysA) {
|
||||
if (
|
||||
!Object.prototype.hasOwnProperty.call(objB, keysA[i] as string) ||
|
||||
!Object.is(objA[keysA[i] as keyof T], objB[keysA[i] as keyof T])
|
||||
!Object.prototype.hasOwnProperty.call(objB, keyA as string) ||
|
||||
!Object.is(objA[keyA as keyof T], objB[keyA as keyof T])
|
||||
) {
|
||||
return false
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user