Releases: standardschema/javascript
Releases · standardschema/javascript
Refactored Structural and Object Type Checking
Fixed
- Improve structural type checking through inheritance, required and corrected object type check and validation
Transform Type
Added
- New
Types.Transform
- for transforming a value during validation
Array `{min,max}Items`
Added
- Support
types.Array.{min,max}Items
for validation
References
Added
- Concept of value references
- New
Types.Omit
andTypes.Condition
More Graceful Error Handling
Changed
- When an error occurs in
union
orevery
, reject with the first non-validation error (it's likely a code error) - Make
Intersection
andUnion
inherit fromAny
(again) - this is useful foruses
Fix Union Compile
Fixed
- Union types were compiling the old way using
compose
, usetype._compile()
instead
Mutate Type
Added
- Add a
Mutate
type for temporary mutations during tests
New `Rule` Base Class
Changed
- Add
Rule
base class -Any extends Rule
now, while some basic rules come included - Rewrote the middleware pattern in use - now using
next(value) => value
where you can forward values and receive back a value - the defaultnext
is just the identity function
Correct error message strings
Fixed
- Improved the consistency of error message keys
- Update
isType
for string sub-types
Remove `ref` option
Changed
- Remove
ref
fromAnyOptions