Skip to content

Releases: jquense/yup

v0.19.0 - Fri, 24 Jun 2016 15:19:49 GMT

24 Jun 15:23
Compare
Choose a tag to compare

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'