Skip to content

Conversation

@aleclarson
Copy link
Member

@aleclarson aleclarson commented Sep 22, 2025

Summary

  • extend isEqual to handle arrays, enforce matching prototypes, and allow an optional customCompare hook for non-plain objects
  • add comprehensive edge-case coverage in tests/typed/isEqual.test.ts for dates, regexps, arrays, prototype mismatches, and custom comparer behavior
  • refresh docs/typed/isEqual.mdx with a deeper explanation, richer usage example, custom comparison guidance, and caveats

Related issue, if any:

None.

For any code change,

  • Related documentation has been updated, if needed
  • Related tests have been added or updated, if needed
  • Related benchmarks have been added or updated, if needed
  • Release notes in next-minor.md or next-major.md have been added, if needed

Does this PR introduce a breaking change?

No

Bundle impact

Status File Size 1 Difference
M src/typed/isEqual.ts 591 +135 (+30%)

Footnotes

  1. Function size includes the import dependencies of the function.

@radashi-bot
Copy link

Benchmark Results

Name Current Baseline Change
isEqual ▶︎ with numbers 52,855.9 ops/sec ±0.72% 47,973.3 ops/sec ±0.44% 🔗 🚀 +10.18%
isEqual ▶︎ with strings 53,309.95 ops/sec ±0.29% 53,342.19 ops/sec ±0.34% 🔗 🐢 -0.06%
isEqual ▶︎ with objects 50,380.67 ops/sec ±0.33% 49,362.67 ops/sec ±0.62% 🔗 🚀 +2.06%
isEqual ▶︎ with arrays 50,989.58 ops/sec ±0.35% 48,794.12 ops/sec ±0.36% 🔗 🚀 +4.5%
isEqual ▶︎ with complex objects 28,285.59 ops/sec ±1.93% 29,052.27 ops/sec ±2.34% 🔗 🐢 -2.64%

Performance regressions of 30% or more should be investigated, unless they were anticipated. Smaller regressions may be due to normal variability, as we don't use dedicated CI infrastructure.

@kainstar
Copy link

kainstar commented Dec 2, 2025

If the objects compared using isEqual contain DOM nodes, it will throw a Maximum call stack size exceeded error, forcing me to write a separate complete comparison function to fix it.
This custom feature allows me to handle such cases. Could you share an expected timeline for merging and releasing this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants