• Transforms Result<E, Option<T>> into Option<Result<E, T>> as:

    • ok(some(x)) will be mapped to some(ok(x))
    • ok(none()) will be mapped to none()
    • err(e) will be mapped to some(err(e)).

    Type Parameters

    • E

    • T

    Parameters

    Returns Option<Result<E, T>>

    Result containing Option.

    Examples

    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