Skip to content

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

Compare
Choose a tag to compare
@jquense jquense released this 24 Jun 15:23
· 566 commits to master since this release

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'