Skip to content

fix(commons): don't overwrite existing value with undefined in deepMerge#5141

Merged
svozza merged 3 commits intoaws-powertools:mainfrom
faberchri:fix/5138-handling-of-undefined-in-deep-merge-utility
Mar 27, 2026
Merged

fix(commons): don't overwrite existing value with undefined in deepMerge#5141
svozza merged 3 commits intoaws-powertools:mainfrom
faberchri:fix/5138-handling-of-undefined-in-deep-merge-utility

Conversation

@faberchri
Copy link
Copy Markdown
Contributor

Summary

Changes deepMerge utility function to maintain the following behaviour of lodash.merge: Source properties that resolve to undefined are skipped if a destination value exists.

Changes

deepMerge utility and unit tests updated

Issue number: closes #5138


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

Same behaviour as `lodash.merge`: Source properties that resolve to `undefined` are skipped if a destination value exists.
@boring-cyborg
Copy link
Copy Markdown

boring-cyborg bot commented Mar 27, 2026

Thanks a lot for your first contribution! Please check out our contributing guidelines and don't hesitate to ask whatever you need.
In the meantime, check out the #typescript channel on our Powertools for AWS Lambda Discord: Invite link

@pull-request-size pull-request-size bot added the size/M PR between 30-99 LOC label Mar 27, 2026
@svozza svozza changed the title fix(deepMerge): don't overwrite existing value with undefined fix(commons): don't overwrite existing value with undefined Mar 27, 2026
@svozza
Copy link
Copy Markdown
Contributor

svozza commented Mar 27, 2026

Thank you for the PR! Looks good, only one small issue with the Sonarqube finding. Once we fix that, we're good to merge.

Co-authored-by: Andrea Amorosi <dreamorosi@gmail.com>
@dreamorosi dreamorosi requested a review from svozza March 27, 2026 16:22
@dreamorosi
Copy link
Copy Markdown
Contributor

@svozza I committed the change to address the Sonar finding - it's ready to approve & merge

@dreamorosi dreamorosi changed the title fix(commons): don't overwrite existing value with undefined fix(commons): don't overwrite existing value with undefined in deepMerge Mar 27, 2026
@svozza
Copy link
Copy Markdown
Contributor

svozza commented Mar 27, 2026

Sweet. Approved!

@sonarqubecloud
Copy link
Copy Markdown

@svozza svozza merged commit c7c6c0f into aws-powertools:main Mar 27, 2026
46 checks passed
@boring-cyborg
Copy link
Copy Markdown

boring-cyborg bot commented Mar 27, 2026

Awesome work, congrats on your first merged pull request and thank you for helping improve everyone's experience!

@svozza
Copy link
Copy Markdown
Contributor

svozza commented Mar 27, 2026

Nice work @faberchri, all merged now!

@faberchri faberchri deleted the fix/5138-handling-of-undefined-in-deep-merge-utility branch March 27, 2026 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M PR between 30-99 LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: deepMerge should ignore undefined source values

3 participants