Skip to content

Conversation

@gioboa
Copy link
Contributor

@gioboa gioboa commented Aug 28, 2025

Summary

This PR add JsonObjectNode merge method.
Remove any existing destination properties that clash with source, along with their leading/trailing trivia, to avoid duplicate keys.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

@marcospassos marcospassos added the feature New feature label Aug 28, 2025
@marcospassos
Copy link
Member

Hey @gioboa, thanks a lot for the contribution!

I've made a few updates to the API, the main one is turning it into an instance method instead of a static one, so usage now looks like:

destination.merge(source)

I also handled several edge cases and added some logic to make the merging feel more natural. For example, trailing comments are now moved along with the destination property, since they usually belong to the preceding key.

@marcospassos marcospassos merged commit 7f0cbc2 into croct-tech:master Aug 28, 2025
3 of 6 checks passed
@gioboa gioboa deleted the feat/JsonObjectNode-merge branch August 28, 2025 15:15
@gioboa
Copy link
Contributor Author

gioboa commented Aug 28, 2025

Thanks, that's fine to me 💯

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

Labels

feature New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

comments lost while merging

2 participants