plainfp - v0.1.0
    Preparing search index...

    Function map

    • Transform the success value of a Result. Errors short-circuit: if the input is err, fn is not called and the error is propagated unchanged.

      Dual API — works data-first or curried for use in pipe.

      Type Parameters

      • T
      • E
      • U

      Parameters

      Returns ResultType<U, E>

      pipe(
      ok({ id: "u-1", name: "Alice" }),
      Result.map(user => user.name.toUpperCase()),
      )
      // { ok: true, value: "ALICE" }
    • Transform the success value of a Result. Errors short-circuit: if the input is err, fn is not called and the error is propagated unchanged.

      Dual API — works data-first or curried for use in pipe.

      Type Parameters

      • T
      • U

      Parameters

      • fn: (value: T) => U

      Returns <E>(result: ResultType<T, E>) => ResultType<U, E>

      pipe(
      ok({ id: "u-1", name: "Alice" }),
      Result.map(user => user.name.toUpperCase()),
      )
      // { ok: true, value: "ALICE" }