fx-flow v0.7.0 / flow / into
Function: into()
into(fn, result)
into<
A
,R
>(fn
,result
):ReturnValue
<R
>
Convert data of result
.
Type parameters
• A
• R
Parameters
• fn
• result: Result
<A
>
Returns
ReturnValue
<R
>
Example
typescript
const injectUserId = () => 1
const userInfo = (await andThen(queryUserInfo, into(injectUserId, ok()))).unwrap()
// with flow
const userInfo = (await flow(ok(), into(injectUserId), andThen(queryUserInfo), errThen(notify))).unwrapOr(defaultUserInfo)
Source
packages/core/src/flow/into.ts:21
into(fn)
into<
A
,R
>(fn
): (result
) =>ReturnValue
<R
>
Type parameters
• A
• R
Parameters
• fn
Returns
Function
Parameters
• result: Result
<A
>
Returns
ReturnValue
<R
>