v0.9.0: Comprehensive Null/Undefined Safety
🛡️ Null/Undefined Safety for All Functions
This release adds comprehensive null/undefined handling across the entire library, making it safer and more predictable to use.
✨ What's New
Complete Null Safety - All functions now handle null/undefined gracefully:
// No more runtime errors!
slugify(null); // Returns: null
slugify(undefined); // Returns: undefined
// Consistent behavior across all utilities
isEmail(null); // Returns: false
wordCount(null); // Returns: 0🚀 Key Improvements
- 22+ functions updated with defensive null checks
- Zero runtime errors - No more TypeErrors on null/undefined inputs
- Consistent behavior patterns:
- String functions preserve null/undefined
- Boolean functions return
false - Array functions return
[] - Number functions return
0
- Full backward compatibility maintained for valid inputs
- 36 comprehensive tests for null/undefined handling
📊 Impact
- ✅ No performance degradation - Benchmarks show consistent speed
- ✅ Minimal size impact - Only 0.02 kB bundle increase
- ✅ Better developer experience - No need for defensive checks
- ✅ TypeScript alignment - Works perfectly with strict null checks
📦 Installation
npm install [email protected]📚 Documentation
The README now includes a dedicated Null/Undefined Safety section with examples and behavior patterns.
Full Changelog: v0.8.0...v0.9.0