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
| S.assertOrThrow |`('any, S.t<'value>) => ()`| Asserts that the input value is valid. Since the operation doesn't return a value, it's 2-3 times faster than `parseOrThrow` depending on the schema|
1317
1317
1318
1318
All operations either return the output value or raise an exception which you can catch with `try/catch` block:
If you want to have the most possible performance, or the built-in operations doesn't cover your specific use case, you can use `compile` to create fine-tuned operation functions.
1331
1331
1332
1332
```rescript
1333
-
let fn = S.compile(
1333
+
let operation = S.compile(
1334
1334
S.string,
1335
1335
~input=Any,
1336
1336
~output=Assert,
1337
1337
~mode=Async,
1338
1338
)
1339
-
await fn("Hello world!")
1339
+
await operation("Hello world!")
1340
1340
// ()
1341
1341
```
1342
1342
@@ -1356,7 +1356,7 @@ You can configure compiled function `output` with the following options:
1356
1356
-`Unknown` - returns `unknown`
1357
1357
-`Assert` - returns `unit`
1358
1358
-`Json` - validates that the schema is JSON compatible and returns `Js.Json.t`
1359
-
-`JsonString` - validates that the schema is JSON compatible and transforms output to JSON string
1359
+
-`JsonString` - validates that the schema is JSON compatible and converts output to JSON string
1360
1360
1361
1361
You can configure compiled function `mode` with the following options:
0 commit comments