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.
pipe
const message = await pipe( chargeOrder(order), ResultAsync.match({ ok: receipt => `Charged ${receipt.amount}`, err: e => `Failed: ${e.code}`, }), ) Copy
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.