Skip to content

fold

fold<E, A, B>(onErr, onOk, onNil): (outcome) => B

Defined in: Core/Op.ts:590

Eliminates an Outcome with positional handlers. Order: onErr, onOk, onNil — mirrors Result.fold for the first two.

E

A

B

(e) => B

(a) => B

() => B

(outcome): B

Outcome<E, A>

B

Op.fold(
  (e) => `error: ${e.message}`,
  (v) => `value: ${v}`,
  ()  => "nothing",
)(outcome);