Interface IAsyncParallel<TSource>

Common Methods between IAsyncEnumerable and IParallelEnumerable

interface IAsyncParallel<TSource> {
    "[asyncIterator]"(): AsyncIterableIterator<TSource>;
    aggregate(func: (x: TSource, y: TSource) => TSource): Promise<TSource>;
    aggregate<TAccumulate>(
        seed: TAccumulate,
        func: (x: TAccumulate, y: TSource) => TAccumulate,
    ): Promise<TAccumulate>;
    aggregate<TAccumulate, TResult>(
        seed: TAccumulate,
        func: (x: TAccumulate, y: TSource) => TAccumulate,
        resultSelector: (x: TAccumulate) => TResult,
    ): Promise<TResult>;
    all(predicate: (x: TSource) => boolean): Promise<boolean>;
    allAsync(predicate: (x: TSource) => Promise<boolean>): Promise<boolean>;
    any(predicate?: (x: TSource) => boolean): Promise<boolean>;
    anyAsync(predicate: (x: TSource) => Promise<boolean>): Promise<boolean>;
    average(this: IAsyncParallel<number>): Promise<number>;
    average(selector: (x: TSource) => number): Promise<number>;
    averageAsync(selector: (x: TSource) => Promise<number>): Promise<number>;
    contains(
        value: TSource,
        comparer?: IEqualityComparer<TSource>,
    ): Promise<boolean>;
    containsAsync(
        value: TSource,
        comparer: IAsyncEqualityComparer<TSource>,
    ): Promise<boolean>;
    count(predicate?: (x: TSource) => boolean): Promise<number>;
    countAsync(predicate: (x: TSource) => Promise<boolean>): Promise<number>;
    elementAt(index: number): Promise<TSource>;
    elementAtOrDefault(index: number): Promise<null | TSource>;
    first(predicate?: (x: TSource) => boolean): Promise<TSource>;
    firstAsync(predicate: (x: TSource) => Promise<boolean>): Promise<TSource>;
    firstOrDefault(
        predicate?: (x: TSource) => boolean,
    ): Promise<null | TSource>;
    firstOrDefaultAsync(
        predicate: (x: TSource) => Promise<boolean>,
    ): Promise<null | TSource>;
    last(predicate?: (x: TSource) => boolean): Promise<TSource>;
    lastAsync(predicate: (x: TSource) => Promise<boolean>): Promise<TSource>;
    lastOrDefault(predicate?: (x: TSource) => boolean): Promise<null | TSource>;
    lastOrDefaultAsync(
        predicate: (x: TSource) => Promise<boolean>,
    ): Promise<null | TSource>;
    max(this: IAsyncParallel<number>): Promise<number>;
    max(selector: (x: TSource) => number): Promise<number>;
    maxAsync(selector: (x: TSource) => Promise<number>): Promise<number>;
    min(this: IAsyncParallel<number>): Promise<number>;
    min(selector: (x: TSource) => number): Promise<number>;
    minAsync(selector: (x: TSource) => Promise<number>): Promise<number>;
    partition(
        predicate: (x: TSource) => boolean,
    ): Promise<[pass: TSource[], fail: TSource[]]>;
    partitionAsync(
        predicate: (x: TSource) => Promise<boolean>,
    ): Promise<[pass: TSource[], fail: TSource[]]>;
    single(predicate?: (x: TSource) => boolean): Promise<TSource>;
    singleAsync(predicate: (x: TSource) => Promise<boolean>): Promise<TSource>;
    singleOrDefault(
        predicate?: (x: TSource) => boolean,
    ): Promise<null | TSource>;
    singleOrDefaultAsync(
        predicate: (x: TSource) => Promise<boolean>,
    ): Promise<null | TSource>;
    sum(this: IAsyncParallel<number>): Promise<number>;
    sum(selector: (x: TSource) => number): Promise<number>;
    sumAsync(selector: (x: TSource) => Promise<number>): Promise<number>;
    toArray(): Promise<TSource[]>;
    toMap<TKey>(selector: (x: TSource) => TKey): Promise<Map<TKey, TSource[]>>;
    toMapAsync<TKey>(
        selector: (x: TSource) => Promise<TKey>,
    ): Promise<Map<TKey, TSource[]>>;
    toObject<TKey extends string | number | symbol>(
        selector: (x: TSource) => TKey,
    ): Promise<Record<TKey, TSource>>;
    toObjectAsync<TKey extends string | number | symbol>(
        selector: (x: TSource) => Promise<TKey>,
    ): Promise<Record<TKey, TSource>>;
    toSet(): Promise<Set<TSource>>;
}

Type Parameters

  • TSource

Hierarchy (View Summary)

Methods

  • Determines whether all elements of a sequence satisfy a condition.

    Parameters

    • predicate: (x: TSource) => boolean

      A function to test each element for a condition.

    Returns Promise<boolean>

    true if every element of the source sequence passes the test in the specified predicate, or if the sequence is empty; otherwise, false.

  • Determines whether all elements of a sequence satisfy a condition.

    Parameters

    • predicate: (x: TSource) => Promise<boolean>

      An async function to test each element for a condition.

    Returns Promise<boolean>

    true if every element of the source sequence passes the test in the specified predicate, or if the sequence is empty; otherwise, false.

  • Determines whether a sequence contains any elements. If predicate is specified, determines whether any element of a sequence satisfies a condition.

    Parameters

    • Optionalpredicate: (x: TSource) => boolean

      A function to test each element for a condition.

    Returns Promise<boolean>

    true if the source sequence contains any elements or passes the test specified; otherwise, false.

  • Determines whether any element of a sequence satisfies a condition.

    Parameters

    • predicate: (x: TSource) => Promise<boolean>

      An async function to test each element for a condition.

    Returns Promise<boolean>

    true if the source sequence contains any elements or passes the test specified; otherwise, false.

  • Computes the average of a sequence of number values.

    Parameters

    Returns Promise<number>

    The average of the sequence of values.

    source contains no elements.

  • Computes the average of a sequence of values that are obtained by invoking a transform function on each element of the input sequence.

    Parameters

    • selector: (x: TSource) => number

      A transform function to apply to each element.

    Returns Promise<number>

    The average of the sequence of values.

    source contains no elements.

  • Computes the average of a sequence of values that are obtained by invoking a transform function on each element of the input sequence.

    Parameters

    • selector: (x: TSource) => Promise<number>

      An async transform function to apply to each element.

    Returns Promise<number>

    The average of the sequence of values.

    source contains no elements.

  • Determines whether a sequence contains a specified element by using the specified or default IEqualityComparer.

    Parameters

    Returns Promise<boolean>

    true if the source sequence contains an element that has the specified value; otherwise, false.

  • Determines whether a sequence contains a specified element by using the specified or default IEqualityComparer.

    Parameters

    Returns Promise<boolean>

    true if the source sequence contains an element that has the specified value; otherwise, false.

  • Returns the number of elements in a sequence or represents how many elements in the specified sequence satisfy a condition if the predicate is specified.

    Parameters

    • Optionalpredicate: (x: TSource) => boolean

      A function to test each element for a condition. Optional.

    Returns Promise<number>

    The number of elements in the input sequence.

  • Returns the number of elements in a sequence or represents how many elements in the specified sequence satisfy a condition if the predicate is specified.

    Parameters

    • predicate: (x: TSource) => Promise<boolean>

      A function to test each element for a condition.

    Returns Promise<number>

    The number of elements in the input sequence.

  • Returns the element at a specified index in a sequence.

    Parameters

    • index: number

      The zero-based index of the element to retrieve.

    Returns Promise<TSource>

    The element at the specified position in the source sequence.

    index is less than 0 or greater than or equal to the number of elements in source.

  • Returns the element at a specified index in a sequence or a default value if the index is out of range.

    Parameters

    • index: number

      The zero-based index of the element to retrieve.

    Returns Promise<null | TSource>

    null if the index is outside the bounds of the source sequence; otherwise, the element at the specified position in the source sequence.

  • Returns the first element in a sequence that satisfies a specified condition.

    Parameters

    • predicate: (x: TSource) => Promise<boolean>

      A function to test each element for a condition.

    Returns Promise<TSource>

    The first element in the sequence that passes the test in the specified predicate function.

    No elements in Iteration matching predicate

  • Returns first element in sequence that satisfies predicate otherwise returns the first element in the sequence. Returns null if no value found.

    Parameters

    • Optionalpredicate: (x: TSource) => boolean

      A function to test each element for a condition. Optional.

    Returns Promise<null | TSource>

    The first element in the sequence or the first element that passes the test in the specified predicate function. Returns null if no value found.

  • Returns the first element of the sequence that satisfies a condition or a default value if no such element is found.

    Parameters

    • predicate: (x: TSource) => Promise<boolean>

      An async function to test each element for a condition.

    Returns Promise<null | TSource>

    null if source is empty or if no element passes the test specified by predicate; otherwise, the first element in source that passes the test specified by predicate.

  • Returns the maximum value in a sequence of values.

    Parameters

    Returns Promise<number>

    Sequence contains no elements

  • Invokes a transform function on each element of a sequence and returns the maximum value.

    Parameters

    • selector: (x: TSource) => number

      A transform function to apply to each element.

    Returns Promise<number>

    Sequence contains no elements

  • Invokes an async transform function on each element of a sequence and returns the maximum value.

    Parameters

    • selector: (x: TSource) => Promise<number>

      A transform function to apply to each element.

    Returns Promise<number>

    Sequence contains no elements

  • Returns the minimum value in a sequence of values.

    Parameters

    Returns Promise<number>

    Sequence contains no elements

  • Invokes a transform function on each element of a sequence and returns the minimum value.

    Parameters

    • selector: (x: TSource) => number

      A transform function to apply to each element.

    Returns Promise<number>

    Sequence contains no elements

  • Invokes a transform function on each element of a sequence and returns the minimum value.

    Parameters

    • selector: (x: TSource) => Promise<number>

      A transform function to apply to each element.

    Returns Promise<number>

    Sequence contains no elements

  • Partitions the values into a tuple of failing and passing arrays

    Parameters

    • predicate: (x: TSource) => boolean

      Predicate to determine whether a value passes or fails

    Returns Promise<[pass: TSource[], fail: TSource[]]>

    [values that pass, values that fail]

  • Partitions the values into a tuple of failing and passing arrays

    Parameters

    • predicate: (x: TSource) => Promise<boolean>

      Async predicate to determine whether a value passes or fails

    Returns Promise<[pass: TSource[], fail: TSource[]]>

    [values that pass, values that fail]

  • Computes the sum of the sequence of numeric values.

    Parameters

    Returns Promise<number>

    A promise of the sum of the values in the sequence.

  • Computes the sum of the sequence of numeric values that are obtained by invoking a transform function on each element of the input sequence.

    Parameters

    • selector: (x: TSource) => number

      A transform function to apply to each element.

    Returns Promise<number>

    A promise of the sum of the projected values.

  • Computes the sum of the sequence of numeric values that are obtained by invoking a transform function on each element of the input sequence.

    Parameters

    • selector: (x: TSource) => Promise<number>

      An async transform function to apply to each element.

    Returns Promise<number>

    A promise of the sum of the projected values.

  • Converts the Iteration to an Object. Duplicate values will be overriden.

    Type Parameters

    • TKey extends string | number | symbol

    Parameters

    • selector: (x: TSource) => TKey

      A function to determine the Key based on the value.

    Returns Promise<Record<TKey, TSource>>

    Promise of KVP Object

  • Converts the Iteration to an Object. Duplicate values will be overriden.

    Type Parameters

    • TKey extends string | number | symbol

    Parameters

    • selector: (x: TSource) => Promise<TKey>

      An async function to determine the Key based on the value.

    Returns Promise<Record<TKey, TSource>>

    Promise of KVP Object