fix(utils): handle null in isJSONSerializable#579
Conversation
- `null` is JSON serializable but was not recognized as such - `typeof null` returns `"object"`, making the `t === null` check dead code - Accessing `value.buffer` on null threw a TypeError - Fixed by adding an explicit `value === null` check that returns true
|
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 (1)
📝 WalkthroughWalkthrough
ChangesNull handling fix
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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
Fixed
isJSONSerializable(null)throwingTypeErrorand returning incorrect result.Root cause
typeof nullreturns"object", sot === nullwas dead codevalue.bufferwhich threwTypeError: Cannot read properties of nullFix
Added an explicit
value === nullcheck before the typeof check, returningtruesincenullis JSON serializable.Closes #571
Summary by CodeRabbit
nullvalues, preventing errors and ensuring accurate validation of data structures containing null entries.