• Flattens the nested result, The error held by an outer one will be preceded.

    Type Parameters

    • E

    • T

    Parameters

    Returns Result<E, T>

    The unwrapped nest.

    Examples

    import { err, flatten, ok } from "./result.ts";
    import { assertEquals } from "../deps.ts";

    assertEquals(flatten(ok(ok("hello"))), ok("hello"));
    assertEquals(flatten(err(ok("hello"))), err(ok("hello")));
    assertEquals(flatten(ok(err(6))), err(6));
    assertEquals(flatten(err(err(6))), err(err(6)));

Generated using TypeDoc