plainfp - v0.1.0
    Preparing search index...

    Function match

    • Fold a Result 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 U

      pipe(
      chargeOrder(order),
      Result.match({
      ok: receipt => `Charged ${receipt.amount}`,
      err: e => `Failed: ${e.code}`,
      }),
      )
    • Fold a Result 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 (result: ResultType<T, E>) => U

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