Result
containing Option
.
import { err, ok, resOptToOptRes } from "./result.ts";
import { some, none } from "./option.ts";
import { assertEquals } from "../deps.ts";
assertEquals(resOptToOptRes(ok(some(5))), some(ok(5)));
assertEquals(resOptToOptRes(ok(none())), none());
assertEquals(resOptToOptRes(err("hoge")), some(err("hoge")));
Generated using TypeDoc
Transforms
Result<E, Option<T>>
intoOption<Result<E, T>>
as:ok(some(x))
will be mapped tosome(ok(x))
ok(none())
will be mapped tonone()
err(e)
will be mapped tosome(err(e))
.