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

fix: resolve cases when comparing arrays to non-array values #18

Conversation

mfactorial
Copy link

Today, I encountered a bug while comparing two objects using getObjectDiff. In the prevData object, a property had an array value, while in the nextData object, the same property had a non-array value. The isEqual function failed because it only checks if value a is an array. If a is an array, it attempts to get the length of value b, which causes an error when b is not an array.

This fix ensures that the comparison logic correctly handles cases where an array is compared to a non-array value, preventing such errors.

@DoneDeal0
Copy link
Owner

DoneDeal0 commented Jun 24, 2024

Well spotted @mfactorial ! Thank you very much for your pull request!

ps: I will publish a new release when #19 is fixed, so we only bump the lib once.

@DoneDeal0 DoneDeal0 merged commit 270f460 into DoneDeal0:master Jun 24, 2024
1 check passed
@mfactorial mfactorial deleted the bugfix/comparing-arrays-to-non-array-values branch June 26, 2024 14:24
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.

2 participants