plainfp - v0.1.0
    Preparing search index...

    Function map

    • Transform the success value of a ResultAsync. fn may return a value or a Promise. Errors short-circuit: on err, fn is not called and the error propagates unchanged.

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

      Type Parameters

      • T
      • E
      • U

      Parameters

      Returns ResultAsyncType<U, E>

      pipe(
      fetchUser(id),
      ResultAsync.map(user => ({ ...user, name: user.name.trim() })),
      )
    • Transform the success value of a ResultAsync. fn may return a value or a Promise. Errors short-circuit: on err, fn is not called and the error propagates unchanged.

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

      Type Parameters

      • T
      • U

      Parameters

      • fn: (value: T) => U | Promise<U>

      Returns <E>(ra: ResultAsyncType<T, E>) => ResultAsyncType<U, E>

      pipe(
      fetchUser(id),
      ResultAsync.map(user => ({ ...user, name: user.name.trim() })),
      )