Interface IterableQueue<T>

An extended async iterable that can pull from a value pool. Iterable queues can be created via the queue function.

Type Parameters

  • T

    The type of the elements in the iterable queue.

Hierarchy

Properties

at: ((n: number) => Promise<undefined | T>)

Type declaration

    • (n: number): Promise<undefined | T>
    • Parameters

      • n: number

      Returns Promise<undefined | T>

buffer: ((ms: number) => ExtendedAsyncIterable<Awaited<T>>)

Type declaration

close: (() => void)

Type declaration

    • (): void
    • Closes the queue, immediately marking the iterable as complete and stopping the consumption of items.

      Returns void

concat: ((...iterables: (ExtendedAsyncIterable<T> | AsyncIterable<T> | Iterable<T> | ExtendedIterable<T>)[]) => ExtendedAsyncIterable<Awaited<T>>)

Type declaration

consume: (<U>(mapFn?: MapFn<T, U>) => Promise<U[]>)

Type declaration

    • <U>(mapFn?: MapFn<T, U>): Promise<U[]>
    • Type Parameters

      • U

      Parameters

      • Optional mapFn: MapFn<T, U>

      Returns Promise<U[]>

every: ((predicate: AsyncArrayLikePredicate<T>) => Promise<boolean>)

Type declaration

filter: ((predicate: AsyncArrayLikePredicate<T>) => ExtendedAsyncIterable<Awaited<T>>)

Type declaration

find: ((predicate: AsyncArrayLikePredicate<T>) => Promise<undefined | T>)

Type declaration

first: ((predicate?: AsyncArrayLikePredicate<T>) => ExtendedAsyncIterable<Awaited<T>>)

Type declaration

forEach: ((fn: ((element: T, index: number) => MaybePromise<void>)) => ExtendedAsyncIterable<Awaited<T>>)

Type declaration

fork: ((n?: number) => IterableQueue<T>[])

Type declaration

    • (n?: number): IterableQueue<T>[]
    • Forks the queue into n sub-queues (default 2). Each sub-queue receives the same values as the original queue.

      Parameters

      • Optional n: number

      Returns IterableQueue<T>[]

getIterator: (() => AsyncIterator<T, any, undefined>)

Type declaration

    • (): AsyncIterator<T, any, undefined>
    • Returns AsyncIterator<T, any, undefined>

isEmpty: (() => Promise<boolean>)

Type declaration

    • (): Promise<boolean>
    • Returns Promise<boolean>

map: (<U>(mapFn: MapFn<T, U>) => ExtendedAsyncIterable<Awaited<U>>)

Type declaration

push: ((value: T) => void)

Type declaration

    • (value: T): void
    • Pushes a new value onto the queue, making it available for consumption.

      Parameters

      • value: T

      Returns void

reduce: (<U>(reducer: AsyncReducer<T, U>, initialValue?: U) => Promise<U>)

Type declaration

    • <U>(reducer: AsyncReducer<T, U>, initialValue?: U): Promise<U>
    • Type Parameters

      • U = T

      Parameters

      Returns Promise<U>

scan: (<U>(reducer: AsyncReducer<T, U>, initialValue?: U) => ExtendedAsyncIterable<Awaited<U>>)

Type declaration

seal: (() => void)

Type declaration

    • (): void
    • Seals the queue, preventing new values from being pushed. The queue is marked as complete once the value pool is empty.

      Returns void

slice: ((startIndex: number, endIndex?: number) => ExtendedAsyncIterable<Awaited<T>>)

Type declaration

some: ((predicate: AsyncArrayLikePredicate<T>) => Promise<boolean>)

Type declaration

take: ((n: number) => ExtendedAsyncIterable<Awaited<T>>)

Type declaration

throttle: ((ms: number) => ExtendedAsyncIterable<Awaited<T>>)

Type declaration

toArray: (() => Promise<T[]>)

Type declaration

    • (): Promise<T[]>
    • Returns Promise<T[]>

Methods

  • Returns AsyncIterator<T, any, undefined>

Generated using TypeDoc