You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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'
```
Set the minimum date allowed. When a string is provided it will attempt to cast to a date first
@@ -805,6 +829,10 @@ array().of(number())
805
829
array(number())
806
830
```
807
831
832
+
The default `cast` behavior for `array` is: [`JSON.parse`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse)
833
+
834
+
Failed casts return: `null`;
835
+
808
836
#### `array.of(type: Schema): Schema`
809
837
810
838
Specify the schema of array elements. `of()` is optional and when omitted the array schema will
@@ -876,6 +904,10 @@ object({
876
904
})
877
905
```
878
906
907
+
The default `cast` behavior for `object` is: [`JSON.parse`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse)
0 commit comments