plainfp - v0.1.0
    Preparing search index...

    Function match

    • Await a ResultAsync and fold it into a single value by running the matching branch.

      Dual API — works data-first or curried for use in pipe.

      Type Parameters

      • T
      • E
      • U

      Parameters

      Returns Promise<U>

      const message = await pipe(
      chargeOrder(order),
      ResultAsync.match({
      ok: receipt => `Charged ${receipt.amount}`,
      err: e => `Failed: ${e.code}`,
      }),
      )
    • Await a ResultAsync and fold it into a single value by running the matching branch.

      Dual API — works data-first or curried for use in pipe.

      Type Parameters

      • T
      • E
      • U

      Parameters

      Returns (ra: ResultAsyncType<T, E>) => Promise<U>

      const message = await pipe(
      chargeOrder(order),
      ResultAsync.match({
      ok: receipt => `Charged ${receipt.amount}`,
      err: e => `Failed: ${e.code}`,
      }),
      )