Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add comparison of functions by content #115

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

quantizor
Copy link

Description

Fixes #114

It's a very common pattern to declare functions inline now-a-days, which causes problems when used with react-fast-compare because the library currently only compares functions referentially.

Checklist:

  • All tests are passing
  • Type definitions, if updated, pass both test-ts-defs and test-ts-usage
  • Benchmark performance has not significantly decreased
  • Bundle size has not been significantly impacted
  • The bundle size badge has been updated to reflect the new size

@@ -18,8 +18,7 @@ function equal(a, b) {
if (Array.isArray(a)) {
length = a.length;
if (length != b.length) return false;
for (i = length; i-- !== 0;)
if (!equal(a[i], b[i])) return false;
for (i = length; i-- !== 0; ) if (!equal(a[i], b[i])) return false;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, it looks like my IDE prettier settings did a bit of reformatting here. If there's a particular code style that's meant to be followed, would be good to get a prettier config into the repo

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the source code comments indicate, we track upstream source code from https://github.com/epoberezkin/fast-deep-equal and then place our updates inside. Community PRs usually just attempt to update our specific modifications here or update the upstream library first.

@scottrippey scottrippey added enhancement New feature or request investigate Needs first level triage / investigation labels Aug 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request investigate Needs first level triage / investigation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ability to compare functions
3 participants