Function: map()
Applies a transformation function to the success value of a Result or ResultAsync. If the input is a Failure, it will be returned unchanged.
Type Param
The input Result or ResultAsync.
Type Param
The transformed success value type.
Examples
See
pipe - It is recommended to use this function with the pipe function for better readability and composability.
Call Signature
map<
R1,T2>(fn): (result) =>ResultFor<R1,T2,InferFailure<R1>>
Type Parameters
R1
R1 extends ResultMaybeAsync<any, any>
T2
T2
Parameters
fn
(a) => T2
Returns
(
result):ResultFor<R1,T2,InferFailure<R1>>
Parameters
result
R1
Returns
ResultFor<R1, T2, InferFailure<R1>>
Call Signature
map<
T1,T2>(fn): <R1>(result) =>ResultFor<R1,T2,InferFailure<R1>>
Type Parameters
T1
T1
T2
T2
Parameters
fn
(a) => T2
Returns
<
R1>(result):ResultFor<R1,T2,InferFailure<R1>>
Type Parameters
R1
R1 extends ResultMaybeAsync<T1, any>
Parameters
result
R1
Returns
ResultFor<R1, T2, InferFailure<R1>>
