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

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

    Type Parameters

    • E

    • T

    Parameters

    Returns Result<E, Option<T>>

    Result containing Option.

    Examples

    import { optResToResOpt, some, none } from "./option.ts";
    import { err, ok } from "./result.ts";
    import { assertEquals } from "../deps.ts";

    assertEquals(optResToResOpt(some(ok(5))), ok(some(5)));
    assertEquals(optResToResOpt(none()), ok(none()));
    assertEquals(optResToResOpt(some(err(5))), err(5));

Generated using TypeDoc