Skip to content

Commit

Permalink
add a fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
dai-shi committed Oct 16, 2024
1 parent 45b83eb commit a5496d7
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/vanilla/shallow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,14 @@ export function shallow<T>(objA: T, objB: T): boolean {
nextA.value.length === 2 &&
nextB.value.length === 2
) {
return compareMapLike(
objA as Iterable<[unknown, unknown]>,
objB as Iterable<[unknown, unknown]>,
)
try {
return compareMapLike(
objA as Iterable<[unknown, unknown]>,
objB as Iterable<[unknown, unknown]>,
)
} catch {
// fallback
}
}
while (!nextA.done && !nextB.done) {
if (!Object.is(nextA.value, nextB.value)) {
Expand Down

0 comments on commit a5496d7

Please sign in to comment.