|
|
|
|
|
by mullsork
1022 days ago
|
|
JS doesn't have any useful built-in way to deal with success/failure, other than exceptions. We use Boxed[1] for this: Result
.fromExecution(() => schema.parse(input))
.mapOk(parsed_input => /* */)
.mapError(parse_errors => /* */)
which is an alright way to deal with things IMO.I would hazard a guess that `parse` is a function introduced long ago, and `safeParse` came afterwards. (Safe as in "do not throw an exception") [1]: https://github.com/swan-io/boxed |
|