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: only merge plain objects #111

Merged
merged 4 commits into from Oct 24, 2023
Merged

fix: only merge plain objects #111

merged 4 commits into from Oct 24, 2023

Conversation

pi0
Copy link
Member

@pi0 pi0 commented Oct 24, 2023

πŸ”— Linked issue

resolves #100

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

When merging two objects, we were not checking if two objects are not pure object and also using Object.assign to merge even classes, which can lead to unwanted behavior such as merging two Date values.

This PR fixes this issue by adding little bit of overhead to the checks using a fork of is-plain-obj

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@codecov
Copy link

codecov bot commented Oct 24, 2023

Codecov Report

Merging #111 (06ba4d8) into main (59d0f6a) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##              main      #111   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines           79        92   +13     
  Branches        24        28    +4     
=========================================
+ Hits            79        92   +13     
Files Coverage Ξ”
src/defu.ts 100.00% <100.00%> (ΓΈ)

@pi0 pi0 merged commit 4111333 into main Oct 24, 2023
3 checks passed
@pi0 pi0 deleted the fix/plain-merge branch October 24, 2023 23:05
@pi0 pi0 mentioned this pull request Nov 8, 2023
8 tasks
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.

merge date bug
1 participant