rightAsyncPipe
Asynchronous version of rightPipe. Automatically handles promises, Future, and Either, and short-circuits on the first Left.
Interactive example
Syntax
typescript
function rightAsyncPipe<
GenericInput extends MaybeFutureEither<AnyValue>,
GenericOutputPipe1 extends MaybeFutureEither<AnyValue>
>(
input: GenericInput,
pipe1: EitherRightAsyncPipeFunction<GenericInput, GenericOutputPipe1>
): Future<EitherRightAsyncPipeResult<GenericInput | GenericOutputPipe1, GenericOutputPipe1>>;
// ... overloads up to 15 stepsEitherRightAsyncPipeFunction receives the unwrapped value of a Right (after await) and can return a raw value, an Either, or a promise/Future of these values.
Parameters
input: StartingEither, promise, orFuture.pipeX: Async or sync functions executed sequentially. The pipeline stops on the firstLeft.
Return value
A Future resolved with the last Right if everything succeeds, or the Left that interrupted the pipeline.
Best practices
- Prefix your information with a clear namespace (
"user.fetch","user.validate") to track progress. - Combine
rightAsyncPipeandrightPipedepending on whether your steps are sync/async. - In a
Promise/Futuremix, letrightAsyncPipehandle the normalization.
