fx-flow v0.7.0 / flow / errThenEnd
Function: errThenEnd()
errThenEnd(fn, result, modifier)
errThenEnd<
A
>(fn
,result
,modifier
):MaybePromise
<Result
<A
>>
Call fn
if result
is failure, then exit flow.
Type parameters
• A
Parameters
• fn
• result: Result
<A
>
• modifier: Modifier
Returns
MaybePromise
<Result
<A
>>
Example
typescript
const userInfo = (await flow(ok(filePath), andThen(readFileToStr), errThenEnd(notify), andThen(calcLineCount))).unwrapOr(0)
Source
packages/core/src/flow/errThenEnd.ts:16
errThenEnd(fn)
errThenEnd<
A
>(fn
): (result
,modifier
) =>MaybePromise
<Result
<A
>>
Type parameters
• A
Parameters
• fn
Returns
Function
Parameters
• result: Result
<A
>
• modifier: Modifier
Returns
MaybePromise
<Result
<A
>>
Source
packages/core/src/flow/errThenEnd.ts:21
errThenEnd(fn, result, modifier)
errThenEnd<
A
>(fn
,result
,modifier
):Result
<A
>
Type parameters
• A
Parameters
• fn
• result: Result
<A
>
• modifier: Modifier
Returns
Result
<A
>
Source
packages/core/src/flow/errThenEnd.ts:24
errThenEnd(fn)
errThenEnd<
A
>(fn
): (result
,modifier
) =>Result
<A
>
Type parameters
• A
Parameters
• fn
Returns
Function
Parameters
• result: Result
<A
>
• modifier: Modifier
Returns
Result
<A
>