Function: map()
Applies a transformation function to the value of an Option or OptionAsync. If the input is a None, it is returned unchanged.
Type Param
O
The input Option or OptionAsync.
Type Param
U
The transformed value type.
Examples
Some Case
None Case (unchanged)
See
pipe - It is recommended to use this function with the pipe function for better readability and composability.
Call Signature
map<
O,U>(fn): (option) =>OptionFor<O,U>
Type Parameters
O
O extends OptionMaybeAsync<any>
U
U
Parameters
fn
(a) => U
Returns
(option) => OptionFor<O, U>
Call Signature
map<
T,U>(fn): <O2>(option) =>OptionFor<O2,U>
Type Parameters
T
T extends NonNullableValue
U
U extends NonNullableValue
Parameters
fn
(a) => U
Returns
<O2>(option) => OptionFor<O2, U>