Type Alias IAsyncCollection<TInput>

IAsyncCollection<TInput>: AsyncIterable<TInput> & {
    abort(signal: AbortSignal): IAsyncCollection<TInput>;
    after(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): Promise<null | TInput>;
    afterOr<TExtended>(defaultValue: AsyncLazyable<TExtended>, predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): Promise<TInput | TExtended>;
    afterOrFail(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): Promise<TInput>;
    append<TExtended>(iterable: AsyncIterableValue<TInput | TExtended>): IAsyncCollection<TInput | TExtended>;
    average(): Promise<EnsureType<TInput, number>>;
    before(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): Promise<null | TInput>;
    beforeOr<TExtended>(defaultValue: AsyncLazyable<TExtended>, predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): Promise<TInput | TExtended>;
    beforeOrFail(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): Promise<TInput>;
    change<TFilterOutput, TMapOutput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>, TFilterOutput>, mapFn: AsyncMap<TFilterOutput, IAsyncCollection<TInput>, TMapOutput>): IAsyncCollection<ChangendItem<TInput, TFilterOutput, TMapOutput>>;
    chunk(chunkSize: number): IAsyncCollection<IAsyncCollection<TInput>>;
    chunkWhile(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): IAsyncCollection<IAsyncCollection<TInput>>;
    collapse(): IAsyncCollection<AsyncCollapse<TInput>>;
    count(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): Promise<number>;
    countBy<TOutput>(selectFn?: AsyncMap<TInput, IAsyncCollection<TInput>, TOutput>): IAsyncCollection<RecordItem<TOutput, number>>;
    crossJoin<TExtended>(iterable: AsyncIterableValue<TExtended>): IAsyncCollection<CrossJoinResult<TInput, TExtended>>;
    delay(timeInMs: number): IAsyncCollection<TInput>;
    difference<TOutput>(iterable: AsyncIterableValue<TInput>, selectFn?: AsyncMap<TInput, IAsyncCollection<TInput>, TOutput>): IAsyncCollection<TInput>;
    entries(): IAsyncCollection<RecordItem<number, TInput>>;
    every<TOutput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): Promise<boolean>;
    filter<TOutput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): IAsyncCollection<TOutput>;
    first<TOutput>(predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): Promise<null | TOutput>;
    firstOr<TOutput, TExtended>(defaultValue: AsyncLazyable<TExtended>, predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): Promise<TOutput | TExtended>;
    firstOrFail<TOutput>(predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): Promise<TOutput>;
    flatMap<TOutput>(mapFn: AsyncMap<TInput, IAsyncCollection<TInput>, Iterable<TOutput, any, any>>): IAsyncCollection<TOutput>;
    forEach(callback: AsyncForEach<TInput, IAsyncCollection<TInput>>): Promise<void>;
    groupBy<TOutput>(selectFn?: AsyncMap<TInput, IAsyncCollection<TInput>, TOutput>): IAsyncCollection<RecordItem<TOutput, IAsyncCollection<TInput>>>;
    insertAfter<TExtended>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>, iterable: AsyncIterableValue<TInput | TExtended>): IAsyncCollection<TInput | TExtended>;
    insertBefore<TExtended>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>, iterable: AsyncIterableValue<TInput | TExtended>): IAsyncCollection<TInput | TExtended>;
    isEmpty(): Promise<boolean>;
    isNotEmpty(): Promise<boolean>;
    join(separator?: string): Promise<EnsureType<TInput, string>>;
    keys(): IAsyncCollection<number>;
    last<TOutput>(predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): Promise<null | TOutput>;
    lastOr<TOutput, TExtended>(defaultValue: AsyncLazyable<TExtended>, predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): Promise<TOutput | TExtended>;
    lastOrFail<TOutput>(predicateFn?: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): Promise<TOutput>;
    map<TOutput>(mapFn: AsyncMap<TInput, IAsyncCollection<TInput>, TOutput>): IAsyncCollection<TOutput>;
    max(): Promise<EnsureType<TInput, number>>;
    median(): Promise<EnsureType<TInput, number>>;
    min(): Promise<EnsureType<TInput, number>>;
    nth(step: number): IAsyncCollection<TInput>;
    padEnd<TExtended>(maxLength: number, fillItems: AsyncIterableValue<TExtended>): IAsyncCollection<TInput | TExtended>;
    padStart<TExtended>(maxLength: number, fillItems: AsyncIterableValue<TExtended>): IAsyncCollection<TInput | TExtended>;
    page(page: number, pageSize: number): IAsyncCollection<TInput>;
    partition(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): IAsyncCollection<IAsyncCollection<TInput>>;
    percentage(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): Promise<number>;
    pipe<TOutput>(callback: AsyncTransform<IAsyncCollection<TInput>, TOutput>): Promise<TOutput>;
    prepend<TExtended>(iterable: AsyncIterableValue<TInput | TExtended>): IAsyncCollection<TInput | TExtended>;
    reduce(reduceFn: AsyncReduce<TInput, IAsyncCollection<TInput>, TInput>): Promise<TInput>;
    reduce(reduceFn: AsyncReduce<TInput, IAsyncCollection<TInput>, TInput>, initialValue: TInput): Promise<TInput>;
    reduce<TOutput>(reduceFn: AsyncReduce<TInput, IAsyncCollection<TInput>, TOutput>, initialValue: TOutput): Promise<TOutput>;
    reject<TOutput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): IAsyncCollection<Exclude<TInput, TOutput>>;
    repeat(amount: number): IAsyncCollection<TInput>;
    reverse(chunkSize?: number): IAsyncCollection<TInput>;
    searchFirst(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): Promise<number>;
    searchLast(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): Promise<number>;
    shuffle(mathRandom?: (() => number)): IAsyncCollection<TInput>;
    size(): Promise<number>;
    skip(offset: number): IAsyncCollection<TInput>;
    skipUntil(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): IAsyncCollection<TInput>;
    skipWhile(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): IAsyncCollection<TInput>;
    slice(start?: number, end?: number): IAsyncCollection<TInput>;
    sliding(chunkSize: number, step?: number): IAsyncCollection<IAsyncCollection<TInput>>;
    sole<TOutput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): Promise<TOutput>;
    some<TOutput>(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>, TOutput>): Promise<boolean>;
    sort(comparator?: Comparator<TInput>): IAsyncCollection<TInput>;
    split(chunkAmount: number): IAsyncCollection<IAsyncCollection<TInput>>;
    sum(): Promise<EnsureType<TInput, number>>;
    take(limit: number): IAsyncCollection<TInput>;
    takeUntil(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): IAsyncCollection<TInput>;
    takeWhile(predicateFn: AsyncPredicate<TInput, IAsyncCollection<TInput>>): IAsyncCollection<TInput>;
    tap(callback: AsyncTap<IAsyncCollection<TInput>>): IAsyncCollection<TInput>;
    timeout(timeInMs: number): IAsyncCollection<TInput>;
    toArray(): Promise<TInput[]>;
    toIterator(): AsyncIterator<TInput, void, any>;
    unique<TOutput>(selectFn?: AsyncMap<TInput, IAsyncCollection<TInput>, TOutput>): IAsyncCollection<TInput>;
    values(): IAsyncCollection<TInput>;
    when<TExtended>(condition: boolean, callback: AsyncModifier<IAsyncCollection<TInput>, IAsyncCollection<TExtended>>): IAsyncCollection<TInput | TExtended>;
    whenEmpty<TExtended>(callback: AsyncModifier<IAsyncCollection<TInput>, IAsyncCollection<TExtended>>): IAsyncCollection<TInput | TExtended>;
    whenNot<TExtended>(condition: boolean, callback: AsyncModifier<IAsyncCollection<TInput>, IAsyncCollection<TExtended>>): IAsyncCollection<TInput | TExtended>;
    whenNotEmpty<TExtended>(callback: AsyncModifier<IAsyncCollection<TInput>, IAsyncCollection<TExtended>>): IAsyncCollection<TInput | TExtended>;
    zip<TExtended>(iterable: AsyncIterableValue<TExtended>): IAsyncCollection<RecordItem<TInput, TExtended>>;
}

IAsyncCollection is immutable. The throwOnIndexOverflow parameter in the IAsyncCollection methods is used for preventing the index to overflow by throwing an error.

Type Parameters

  • TInput

Type declaration