@telostat/prelude - v0.7.0
    Preparing search index...

    Interface EitherAsyncTypeRef

    interface EitherAsyncTypeRef {
        all<L, R>(eas: readonly EitherAsync<L, R>[]): EitherAsync<L, R[]>;
        fromPromise<L, R>(f: () => PromiseLike<Either<L, R>>): EitherAsync<L, R>;
        lefts<L, R>(list: readonly EitherAsync<L, R>[]): Promise<L[]>;
        liftEither<L, R>(either: Either<L, R>): EitherAsync<L, R>;
        rights<L, R>(list: readonly EitherAsync<L, R>[]): Promise<R[]>;
        sequence<L, R>(eas: readonly EitherAsync<L, R>[]): EitherAsync<L, R[]>;
        <L, R>(
            runPromise: (helpers: EitherAsyncHelpers<L>) => PromiseLike<R>,
        ): EitherAsync<L, R>;
    }
    • Constructs an EitherAsync object from a function that takes an object full of helpers that let you lift things into the EitherAsync context and returns a Promise

      Type Parameters

      • L
      • R

      Parameters

      • runPromise: (helpers: EitherAsyncHelpers<L>) => PromiseLike<R>

      Returns EitherAsync<L, R>

    Index

    Methods

    • The same as EitherAsync.sequence, but it will run all async operations at the same time rather than sequentially

      Type Parameters

      • L
      • R

      Parameters

      Returns EitherAsync<L, R[]>

    • Constructs an EitherAsync object from a function that returns an Either wrapped in a Promise

      Type Parameters

      • L
      • R

      Parameters

      Returns EitherAsync<L, R>

    • Takes a list of EitherAsyncs and returns a Promise that will resolve with all Left values. Internally it uses Promise.all to wait for all results

      Type Parameters

      • L
      • R

      Parameters

      Returns Promise<L[]>

    • Constructs an EitherAsync object from an Either

      Type Parameters

      • L
      • R

      Parameters

      Returns EitherAsync<L, R>

    • Takes a list of EitherAsyncs and returns a Promise that will resolve with all Right values. Internally it uses Promise.all to wait for all results

      Type Parameters

      • L
      • R

      Parameters

      Returns Promise<R[]>

    • Turns a list of EitherAsyncs into an EitherAsync of list. The returned Promise will be rejected as soon as a single EitherAsync resolves to a Left, it will not wait for all Promises to resolve and since EitherAsync is lazy, unlike Promise, the remaining async operations will not be executed at all

      Type Parameters

      • L
      • R

      Parameters

      Returns EitherAsync<L, R[]>