Skip to content

bind

bind<K, E, A, B>(key, f): (data) => Result<E, A & { [P in string]: B }>

Defined in: Core/Result.ts:331

Evaluates a new Result using the current accumulator and attaches the output to a new key.

K extends string

E

A

B

K

(a) => Result<E, B>

(data) => Result<E, A & { [P in string]: B }>

pipe(
  Result.ok({ a: 1 }),
  Result.bind("b", ({ a }) => Result.ok(a + 1))
); // Ok({ a: 1, b: 2 })