Releases: AlexGalays/idonttrustlikethat
2.1.2
2.1.0
(Tiny) Breaking change: Fix the path of nested dictionary value errors: they would stop at the dictionary level instead of reporting the complete path.
2.0.6
- Improvement: When using
nonEmpty
with an Array as input, the returned type will beNonEmptyArray
, allowing you to safely access the first element even with thenoUncheckedIndexedAccess
compiler arg.
2.0.5
improvement:
discriminatedUnion
now can point not only to a literal validator but also to a union of literals.
Fix:
- The last
withError
would always win, it now propagates properly (you can have as manywithError
chained with other transformations.
2.0.4
Fix: discriminatedUnion
now accepts intersections
of Objects.
2.0.3
default()
now implicitly callnullable()
before it.
2.0.2
Fix type inference issue with nonEmpty
2.0.1
Move all the extra
validators back into the main module.
2.0.0
- Introduce a new module:
idonttrustlikethat/extra
which will contain various non critical validators that I found are still useful in many cases.
The rationale for a new extra
module is that many people are doing import * as v from 'idonttrustlikethat'
but I hope they do import {isoDate} from 'idonttrustlikethat/extra'
and can beneficiate from tree shaking. There's not much to tree shake in the main module as it contain all the JSON validators and utilities around those. Also, extra
is a nice showcase of how easy it is to create new validators from the basic building blocks.
Added new extra validators:
url
absoluteUrl
relativeUrl
minSize
nonEmpty
booleanFromString
numberFromString
intFromString
Breaking changes:
flatMap
is renamed toand
.isoDate
,recursion
andsnakeCaseTransformation
are moved toextra
.withError()
now takes a function with the first argument being the value that we tried to validate.