Skip to content

fold

fold<E, A, B>(onInvalid, onValid): (data) => B

Defined in: Core/Validation.ts:162

Extracts the value from a Validation by providing handlers for both cases.

E

A

B

(errors) => B

(a) => B

(data): B

Validation<E, A>

B

pipe(
  Validation.of(42),
  Validation.fold(
    errors => `Errors: ${errors.join(", ")}`,
    value => `Value: ${value}`
  )
);