A better isEmpty
Hardening of isEmpty() (and its alias Resource.iE()). Numeric and date checks no longer let invalid values pass, and three new field types were added.
All changes affect only isEmpty / iE; nothing else in the library changes.
⚠️ Minor breaking changes
'date' is now strict. Only a calendar-valid YYYY-MM-DD string is accepted. Date objects, epoch numbers, full datetime strings (2026-05-22T10:00:00Z) and other formats (05/22/2026, 2026) are now reported as empty/invalid.
→ Pass YYYY-MM-DD strings, or use the new 'datetime' type for full ISO strings.
'boolean': false is now a valid value. isEmpty(false, 'boolean') returns false (was true). Only non-booleans (null, undefined, …) are empty now.
→ If you used iE(flag) to enforce "must be true", replace it with an explicit check: if (!this.flag) e.push('flag').
'object' arrays measure length, not truthiness. An array is empty only when it has zero elements; [0], [false], [''] are no longer "empty" (now consistent with Resource.cleanArray).
→ Usually no action needed — affects only arrays whose elements are all falsy.
✨ New
'number'/'positiveNumber'hardened —NaN,Infinityand non-numbers (e.g. the string'5') are now correctly reported as empty/invalid.- New
'integer'/'positiveInteger'—iE(qty, 'positiveInteger')replaces!qty || qty <= 0 || !Number.isInteger(qty). - New
'datetime'— validates complete ISO 8601 date-time strings (YYYY-MM-DDTHH:mm:ss…); a date-only string is rejected (use'date'). - Explicit
typeofguards on all string-based types (string,email,phone,url,domain) — wrong runtime types fail predictably instead of viatry/catch.
Upgrade check
Audit the validate() methods of consumer projects:
grep -rnE "(iE|isEmpty)\([^)]*,\s*['\"](date|boolean)['\"]" --include='*.ts' srcReview every 'date' hit (the field must be a YYYY-MM-DD string) and every 'boolean' hit — plus any iE() on a boolean field: a check that was rejecting false must be rewritten as an explicit condition.