Conversation
`Object.keys()` does not iterate over Symbol keys, causing them to be
ignored during merge. This changes the iteration to `Reflect.ownKeys()`
which includes both string and symbol keys.
The spread operator in `{ ...defaults }` already copies symbol keys
from the defaults object, but symbol keys from `baseObject` were
silently dropped.
Fixes unjs#145
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Fixes #145
Object.keys()does not iterate over Symbol keys, causing them to be silently dropped during merge. This changes the iteration toReflect.ownKeys()which includes both string and symbol keys.Root Cause
The spread in
{ ...defaults }already copies symbol keys from defaults, but symbol keys frombaseObjectwere ignored.Fix
Tests
Added 3 test cases:
merges symbol keys— full merge with override + array concatpreserves symbol keys from defaults— symbol key in defaults onlyoverrides symbol keys from base— symbol key in base overrides defaultAll 26 tests pass. Lint and type checks clean.
Summary by CodeRabbit
New Features
Tests