import { R } from "https://deno.land/x/ahh@v0.10.3/mod.ts";
Functionality for Result
.
Static Methods
Return other
if res
is Ok
, or res
.
Returns whether res
strictly equals value
, or false
if it is an
Err
.
containsErr<T, E extends Error>(res: Result<T, E>, value: E): boolean
Returns whether res
strictly equals value
, or false
if it is an
Ok
.
This only checks whether res
and value
have the
same name
and message
.
inspectErr<T, E extends Error>(res: Result<T, E>, f: (_: E) => unknown): Result<T, E>
Calls f
with res
, and returns the original res
.
Return res
if it is an Ok
, or other
.
Returns res
if it is an Ok
, or throws.