@allynet/ishod
    Preparing search index...

    Function unwrapEither

    • Unwrap a result and return either the data or the error. You probably shouldn't use this function and use unwrap or unwrapErr instead.

      If the result is an Ok, it will return the data.

      If the result is an Err, it will return the error.

      Type Parameters

      • T
      • E

      Parameters

      • ok: Promise<Ok<T>>

      Returns Promise<T>

      const result: Result<1, string> = ok(1);
      const value: 1 | string = unwrapEither(result); // 1
      const result: Result<number, "error"> = err("error");
      const value: number | "error" = unwrapEither(result); // "error"
      const result: Promise<Result<number, string>> = Promise.resolve(ok(1));
      const value: Promise<1 | string> = unwrapEither(result); // Promise<1>
      const result: Promise<Result<number, string>> = Promise.resolve(err("error"));
      const value: Promise<number | string> = unwrapEither(result); // Promise<"error">
    • Unwrap a result and return either the data or the error. You probably shouldn't use this function and use unwrap or unwrapErr instead.

      If the result is an Ok, it will return the data.

      If the result is an Err, it will return the error.

      Type Parameters

      • T
      • E

      Parameters

      Returns T

      const result: Result<1, string> = ok(1);
      const value: 1 | string = unwrapEither(result); // 1
      const result: Result<number, "error"> = err("error");
      const value: number | "error" = unwrapEither(result); // "error"
      const result: Promise<Result<number, string>> = Promise.resolve(ok(1));
      const value: Promise<1 | string> = unwrapEither(result); // Promise<1>
      const result: Promise<Result<number, string>> = Promise.resolve(err("error"));
      const value: Promise<number | string> = unwrapEither(result); // Promise<"error">
    • Unwrap a result and return either the data or the error. You probably shouldn't use this function and use unwrap or unwrapErr instead.

      If the result is an Ok, it will return the data.

      If the result is an Err, it will return the error.

      Type Parameters

      • T
      • E

      Parameters

      • err: Promise<Err<E>>

      Returns Promise<E>

      const result: Result<1, string> = ok(1);
      const value: 1 | string = unwrapEither(result); // 1
      const result: Result<number, "error"> = err("error");
      const value: number | "error" = unwrapEither(result); // "error"
      const result: Promise<Result<number, string>> = Promise.resolve(ok(1));
      const value: Promise<1 | string> = unwrapEither(result); // Promise<1>
      const result: Promise<Result<number, string>> = Promise.resolve(err("error"));
      const value: Promise<number | string> = unwrapEither(result); // Promise<"error">
    • Unwrap a result and return either the data or the error. You probably shouldn't use this function and use unwrap or unwrapErr instead.

      If the result is an Ok, it will return the data.

      If the result is an Err, it will return the error.

      Type Parameters

      • T
      • E

      Parameters

      Returns E

      const result: Result<1, string> = ok(1);
      const value: 1 | string = unwrapEither(result); // 1
      const result: Result<number, "error"> = err("error");
      const value: number | "error" = unwrapEither(result); // "error"
      const result: Promise<Result<number, string>> = Promise.resolve(ok(1));
      const value: Promise<1 | string> = unwrapEither(result); // Promise<1>
      const result: Promise<Result<number, string>> = Promise.resolve(err("error"));
      const value: Promise<number | string> = unwrapEither(result); // Promise<"error">
    • Unwrap a result and return either the data or the error. You probably shouldn't use this function and use unwrap or unwrapErr instead.

      If the result is an Ok, it will return the data.

      If the result is an Err, it will return the error.

      Type Parameters

      • T
      • E

      Parameters

      Returns Promise<T | E>

      const result: Result<1, string> = ok(1);
      const value: 1 | string = unwrapEither(result); // 1
      const result: Result<number, "error"> = err("error");
      const value: number | "error" = unwrapEither(result); // "error"
      const result: Promise<Result<number, string>> = Promise.resolve(ok(1));
      const value: Promise<1 | string> = unwrapEither(result); // Promise<1>
      const result: Promise<Result<number, string>> = Promise.resolve(err("error"));
      const value: Promise<number | string> = unwrapEither(result); // Promise<"error">
    • Unwrap a result and return either the data or the error. You probably shouldn't use this function and use unwrap or unwrapErr instead.

      If the result is an Ok, it will return the data.

      If the result is an Err, it will return the error.

      Type Parameters

      • T
      • E

      Parameters

      Returns T | E

      const result: Result<1, string> = ok(1);
      const value: 1 | string = unwrapEither(result); // 1
      const result: Result<number, "error"> = err("error");
      const value: number | "error" = unwrapEither(result); // "error"
      const result: Promise<Result<number, string>> = Promise.resolve(ok(1));
      const value: Promise<1 | string> = unwrapEither(result); // Promise<1>
      const result: Promise<Result<number, string>> = Promise.resolve(err("error"));
      const value: Promise<number | string> = unwrapEither(result); // Promise<"error">