Releases: metreeca/core
Releases · metreeca/core
v0.9.18
Patch release adding type guard combinators, validating casts, and runtime validation utilities.
Added
Guard<T>type alias for type guard functionsGuarded<G>type alias for extracting guarded types from guard arraysisAnywildcard type guard (always succeeds)isUniontype guard for validating values against multiple guards (union types)isOptionaltype guard for validating optional values (undefined | T)isLiteraltype guard for validating literal values (single or array of literals)isSometype guard for validatingSome<T>values (single value or array of values)isLazytype guard for validatingLazy<T>values (plain value or no-arg function)"hierarchical"variant for URI/IRI validation (absolute with/-rooted path, usable as resolution base)- Optional
isparameter toisArray/asArrayfor element validation; receives(value, index) - Tuple template validation for
isArraywith exact length matching - Optional
isparameter toisObject/asObjectsupporting predicate(value, key)or template validation keysymbol for open template validation inisObjectassertvalidation function inerrormoduleasIdentifier,asBoolean,asNumber,asString,asArray,asObjectvalidating cast functionsimmutable(value, guard)overload for type guard validation with memoizationIdentifierPatternregex constant for ECMAScript identifier validationTagPatternregex constant for BCP 47 language tag validationTagRangePatternregex constant for BCP 47 extended language range validation
Changed
- Change
isDefinedto only check forundefined(no longer excludesnull) - Rename
reportmodule toerror - Consolidate
jsonmodule into main index module; import from@metreeca/coreinstead of@metreeca/core/json - Change default
variantparameter from"absolute"to"relative"forisURI,isIRI,asURI,asIRI - Change
isObjecttype parameter from<K, V>to<T extends Record<PropertyKey, unknown>> - Change
asTag,asTagRange,asURI,asIRIto acceptunknownvalues (throwsTypeErrorfor non-strings) - Change
immutableto remove setters from accessor properties for true immutability
Removed
isScalartype guard (useisBoolean(v) || isNumber(v) || isString(v)instead)
Full Changelog: v0.9.17...v0.9.18
v0.9.17
Patch release expanding type utility toolkit with lazy evaluation, unified collection handling,
and enhanced type guards.
Added
Some<T>utility type for handling single values or arrays uniformlyLazy<T>utility type enabling deferred value evaluationisRegExpandisDatetype guard functions- Optional
equalparameter inequals()function for custom equality logic
Changed
- Made
nameparameter optional within theNamespacetype - Replaced branded types with plain type aliases to improve runtime validation compatibility
Full Changelog: v0.9.16...v0.9.17