v0.24.0 - Integer Validation & Enhanced Consistency
🎉 What's New
New Function: isInteger()
Validates if a string represents an integer value (whole number without decimals).
isInteger('42') // true
isInteger('-17') // true
isInteger('3.14') // false - rejects decimals
isInteger('42.0') // false - rejects .0 suffix
isInteger(' 42 ') // true - automatic trimmingKey Features:
- Handles positive and negative integers
- Rejects decimal numbers (key difference from
isNumeric) - Full branded type system integration (
IntegerString) - CLI support:
nano-string isInteger "42" - Bundle size: 120 bytes gzipped
- 80+ test scenarios
Use Cases:
- Age validation
- Pagination parameters (page, limit, offset)
- Database ID validation
- E-commerce quantities
- Form input processing
Enhanced Whitespace Handling
Updated 6 validation functions to consistently trim leading/trailing whitespace:
isASCII,isAlphanumeric,isEmail,isHexColor,isUUID,isUrl
This quality-of-life improvement handles common user input patterns like " [email protected] ".
Code Consistency Improvements
- Standardized variable naming across all validation functions
- All functions now use
const trimmed = str.trim()pattern - More explicit code that avoids parameter mutation
- Better maintainability
📊 Stats
- Function count: 51 → 52 utilities
- Bundle size: 9.05 KB ESM / 9.69 KB CJS (within limits)
- Test coverage: 100% maintained (1465 tests passing)
📦 Installation
npm install [email protected]Full changelog: https://github.com/Zheruel/nano-string-utils/blob/main/CHANGELOG.md#0240---2025-11-07