Releases: jquense/yup
Releases · jquense/yup
v0.19.0 - Fri, 24 Jun 2016 15:19:49 GMT
Type casts no longer "succeed without fail".
For instance boolean
will throw if a cast produces an
invalid type, instead of quietly coercing to false
. By default
cast
will now throw in these situations, passing assert: false
to cast options will disable this behavior and the value returned
will be the invalid value (NaN, InvalidDate, null) or the original value
if no good invalid value exists in the language
number().cast('foo', { assert: false }) // -> NaN
bool().cast('foo', { assert: false }) // -> 'foo'