Releases: unleashy/vahv
Releases · unleashy/vahv
v0.5.0
Added
- Several internal types are now exported
ParserError
to represent errors from theerr
function
Changed
- BREAKING CHANGES:
ParserResult
errors changed; now they take a genericE
type to define
theirerror
property. No code changes are needed if your custom parsers
only use theerr
function.- Instead of throwing on failure,
schema
now returns aParserResult
object. See README.md for details.
Removed
- BREAKING CHANGES:
- Drop support for async validation:
AsyncParser
removed,SyncParser
renamed to justParser
. ValidationError
removed.
- Drop support for async validation:
v0.4.0
v0.3.2
v0.3.1
v0.3.0
Added
ValidationError
, thrown when a validation error occurs.Infer<S>
takes aSchemaParser
and returns the final parsed structure.trim
is a transformer that trims both ends of a given string.defaultTo
is a transformer that applies a default value if necessary.
Changed
- BREAKING CHANGES:
- Vahv now uses a parsing
methodology rather than a validation one. Thus, there are many breaking
changes. and
is now always async and can always take async
parsers.Validator
andAsyncValidator
have been renamed toSyncParser
and
AsyncParser
respectively.Parser
now refers to an union ofSyncParser
andAsyncParser
.schema
’s returned function now returns the parsed contents of the given
data object. If there is a validation error, it throwsValidationError
.- The internal file structure has changed.
- Vahv now uses a parsing
- The messages object may not be exhaustive with regard to the given parsers
anymore, because then you'd need to give error messages for transformers. If
an error message is missing, an error will be thrown at runtime. - Development dependencies have been upgraded to their latest version.
Removed
- BREAKING CHANGE:
asyncAnd
has been removed. Useand
instead.
v0.2.0
Added
- A CHANGELOG file.
asyncAnd
, a validator that can receive sync and async validators alike.
Always returns an async validator.
Changed
schema
now returns aPromise
, resolving to a validation result.- Validator functions can now return a Promise resolving to a validation result.
These are async validators. Note thatand
can only receive sync validators;
useasyncAnd
to compose async validators.