Interface AsyncSequence<T>

A Sequence provides a fluent functional API consisting of various intermediate and terminal operations for processing the iterated data. The operations are evaluated lazily to avoid examining all the input data when it's not necessary. Sequences can be iterated only once.

interface AsyncSequence<T> {
    iterator: AsyncIterator<T, any, undefined>;
    all<T>(this, predicate): Promise<boolean>;
    any<T>(this, predicate?): Promise<boolean>;
    asIterable<T>(this): AsyncIterable<T>;
    associate<T, K, V>(this, transform): Promise<Map<K, V>>;
    associateBy<K>(keySelector): Promise<Map<K, T>>;
    associateBy<K>(key): Promise<Map<NonNullable<T>[K], T>>;
    associateBy<K, V>(keySelector, valueTransformer): Promise<Map<K, V>>;
    associateBy<K, V>(key, valueTransformer): Promise<Map<NonNullable<T>[K], V>>;
    average(this): Promise<number>;
    chunk<T>(this, chunkSize): Promise<T[][]>;
    contains<T>(this, element): Promise<boolean>;
    count<T>(this, predicate?): Promise<number>;
    distinct<T>(this): AsyncSequence<T>;
    distinctBy<T, K>(this, selector): AsyncSequence<T>;
    drop<T>(this, n): AsyncSequence<T>;
    dropWhile<T>(this, predicate): AsyncSequence<T>;
    elementAt<T>(this, index): Promise<T>;
    elementAtOrElse<T>(this, index, defaultValue): Promise<T>;
    elementAtOrNull<T>(this, index): Promise<null | T>;
    filter<T>(this, predicate): AsyncSequence<T>;
    filterIndexed<T>(this, predicate): AsyncSequence<T>;
    filterNot<T>(this, predicate): AsyncSequence<T>;
    filterNotNull<T>(this): AsyncSequence<NonNullable<T>>;
    find<T>(this, predicate?): Promise<null | T>;
    findLast<T>(this, predicate?): Promise<null | T>;
    first<T>(this, predicate?): Promise<T>;
    firstOrNull<T>(this, predicate?): Promise<null | T>;
    flatMap<S, T>(this, transform): AsyncSequence<T>;
    flatten<T>(this): AsyncSequence<T>;
    fold<T, R>(this, initial, operation): Promise<R>;
    foldIndexed<T, R>(this, initial, operation): Promise<R>;
    forEach<T>(this, action): Promise<void>;
    forEachIndexed<T>(this, action): Promise<void>;
    groupBy<T, K>(this, keySelector): Promise<Map<K, T[]>>;
    indexOf<T>(this, element): Promise<number>;
    indexOfFirst<T>(this, predicate): Promise<number>;
    indexOfLast<T>(this, predicate): Promise<number>;
    isEmpty<T>(this): Promise<boolean>;
    isNotEmpty<T>(this): Promise<boolean>;
    joinTo<T>(this, config?): Promise<string>;
    joinToString<T>(this, config?): Promise<string>;
    last<T>(this, predicate?): Promise<T>;
    lastOrNull<T>(this, predicate?): Promise<null | T>;
    map<S, T>(this, transform): AsyncSequence<T>;
    mapIndexed<T, R>(this, transform): AsyncSequence<R>;
    mapNotNull<T, R>(this, transform): AsyncSequence<NonNullable<R>>;
    max<T>(this): Promise<null | T>;
    maxBy<T, R>(this, selector): Promise<null | T>;
    maxWith<T>(this, compare): Promise<null | T>;
    merge<T, S>(this, other, selector, prependNewValues?): AsyncSequence<T>;
    min<T>(this): Promise<null | T>;
    minBy<T, R>(this, selector): Promise<null | T>;
    minWith<T>(this, compare): Promise<null | T>;
    minus<T>(this, data): AsyncSequence<T>;
    none<T>(this, predicate?): Promise<boolean>;
    onEach<T>(this, action): AsyncSequence<T>;
    onEachIndexed<T>(this, action): AsyncSequence<T>;
    partition<T>(this, predicate): Promise<{
        false: T[];
        true: T[];
    }>;
    plus<T>(this, element): AsyncSequence<T>;
    plus<T>(this, other): AsyncSequence<T>;
    plus<T>(this, other): AsyncSequence<T>;
    reduce<S, T>(this, operation): Promise<S>;
    reduceIndexed<S, T>(this, operation): Promise<S>;
    reverse<T>(this): AsyncSequence<T>;
    single<T>(this, predicate?): Promise<T>;
    singleOrNull<T>(this, predicate?): Promise<null | T>;
    sorted<T>(this, composeComparator?): AsyncSequence<T>;
    sortedBy<T, R>(this, selector): AsyncSequence<T>;
    sortedBy<T>(this, key): AsyncSequence<T>;
    sortedByDescending<T, R>(this, selector): AsyncSequence<T>;
    sortedByDescending<T>(this, key): AsyncSequence<T>;
    sortedDescending<T>(this): AsyncSequence<T>;
    sortedWith<T>(this, comparison): AsyncSequence<T>;
    sum(this): Promise<number>;
    sumBy<T>(this, selector): Promise<number>;
    take<T>(this, n): AsyncSequence<T>;
    takeWhile<T>(this, predicate): AsyncSequence<T>;
    toArray<T>(this, array?): Promise<T[]>;
    toList<T>(this, array?): Promise<T[]>;
    toMap<K, V>(this, map?): Promise<Map<K, V>>;
    toMapNotNull<K, V>(this, map?): Promise<Map<NonNullable<K>, NonNullable<V>>>;
    toSequence<T>(this, sequence?): Promise<Sequence<T>>;
    toSet<T>(this, set?): Promise<Set<T>>;
    unzip<T, S>(this): Promise<[T[], S[]]>;
    withIndex<T>(this): AsyncSequence<IndexedValue<T>>;
    zip<T, S>(this, other): AsyncSequence<[T, S]>;
}

Type Parameters

  • T

Hierarchy

  • AsyncSequenceOperators<T>
    • AsyncSequence

Properties

iterator: AsyncIterator<T, any, undefined>

Methods

  • Returns true if all elements match the given predicate.

    Type Parameters

    • T

    Parameters

    • this: AsyncSequence<T>
    • predicate: ((item) => boolean | Promise<boolean>)
        • (item): boolean | Promise<boolean>
        • Parameters

          • item: T

          Returns boolean | Promise<boolean>

    Returns Promise<boolean>

  • Returns true if at least one element match the given predicate.

    Type Parameters

    • T

    Parameters

    • this: AsyncSequence<T>
    • Optional predicate: ((item) => boolean | Promise<boolean>)
        • (item): boolean | Promise<boolean>
        • Parameters

          • item: T

          Returns boolean | Promise<boolean>

    Returns Promise<boolean>

  • Returns an iterable representation of the sequence.

    Type Parameters

    • T

    Parameters

    Returns AsyncIterable<T>

  • Transforms each element into a key-value pair and returns the results as map. In case of duplicate keys the last key-value pair overrides the other.

    Type Parameters

    • T
    • K
    • V

    Parameters

    • this: AsyncSequence<T>
    • transform: ((value) => [K, V] | Promise<[K, V]>)
        • (value): [K, V] | Promise<[K, V]>
        • Parameters

          • value: T

          Returns [K, V] | Promise<[K, V]>

    Returns Promise<Map<K, V>>

  • Returns a map consisting of the elements mapped by the given keySelector.

    Type Parameters

    • K

    Parameters

    • keySelector: ((value) => K | Promise<K>)
        • (value): K | Promise<K>
        • Parameters

          • value: T

          Returns K | Promise<K>

    Returns Promise<Map<K, T>>

  • Returns a map consisting of the elements indexed by the given key.

    Type Parameters

    • K extends string | number | symbol

    Parameters

    • key: K

    Returns Promise<Map<NonNullable<T>[K], T>>

  • Returns a map consisting of the elements mapped by the given keySelector. The value is transformed into another value by the valueTransformer.

    Type Parameters

    • K
    • V

    Parameters

    • keySelector: ((value) => K | Promise<K>)
        • (value): K | Promise<K>
        • Parameters

          • value: T

          Returns K | Promise<K>

    • valueTransformer: ((value) => V | Promise<V>)
        • (value): V | Promise<V>
        • Parameters

          • value: T

          Returns V | Promise<V>

    Returns Promise<Map<K, V>>

  • Returns a map consisting of the elements indexed by the given key. The value is transformed into another value by the valueTransformer.

    Type Parameters

    • K extends string | number | symbol
    • V

    Parameters

    • key: K
    • valueTransformer: ((value) => V | Promise<V>)
        • (value): V | Promise<V>
        • Parameters

          • value: T

          Returns V | Promise<V>

    Returns Promise<Map<NonNullable<T>[K], V>>

  • Returns the average of all numbers of the sequence or NaN if the sequence is empty.

    Parameters

    Returns Promise<number>

  • Splits the elements of the sequence into arrays which length is determined by the given chunkSize and returns all chunks as array.

    Type Parameters

    • T

    Parameters

    Returns Promise<T[][]>

  • Returns true if the sequence contains the given element.

    Type Parameters

    • T

    Parameters

    Returns Promise<boolean>

  • Returns the number of elements of this sequence. If predicate is present, returns the number of elements matching the given predicate.

    Type Parameters

    • T

    Parameters

    • this: AsyncSequence<T>
    • Optional predicate: ((item) => boolean | Promise<boolean>)
        • (item): boolean | Promise<boolean>
        • Parameters

          • item: T

          Returns boolean | Promise<boolean>

    Returns Promise<number>

  • Returns a new sequence which discards all elements with duplicate items determined by the given selector.

    Type Parameters

    • T
    • K

    Parameters

    • this: AsyncSequence<T>
    • selector: ((item) => K | Promise<K>)
        • (item): K | Promise<K>
        • Parameters

          • item: T

          Returns K | Promise<K>

    Returns AsyncSequence<T>

  • Drops all elements of the sequence as long as the given predicate evaluates to true.

    Type Parameters

    • T

    Parameters

    • this: AsyncSequence<T>
    • predicate: ((item) => boolean | Promise<boolean>)
        • (item): boolean | Promise<boolean>
        • Parameters

          • item: T

          Returns boolean | Promise<boolean>

    Returns AsyncSequence<T>

  • Returns the element at position index (zero-based) or throws an error if index is out of bounds.

    Type Parameters

    • T

    Parameters

    Returns Promise<T>

  • Returns the element at position index (zero-based). If index is out of bounds returns the result of the given defaultValue function.

    Type Parameters

    • T

    Parameters

    • this: AsyncSequence<T>
    • index: number
    • defaultValue: ((index) => T | Promise<T>)
        • (index): T | Promise<T>
        • Parameters

          • index: number

          Returns T | Promise<T>

    Returns Promise<T>

  • Returns the element at position index (zero-based) or null if index is out of bounds.

    Type Parameters

    • T

    Parameters

    Returns Promise<null | T>

  • Returns a new sequence consisting of all elements that match the given predicate.

    Type Parameters

    • T

    Parameters

    • this: AsyncSequence<T>
    • predicate: ((item) => boolean | Promise<boolean>)
        • (item): boolean | Promise<boolean>
        • Parameters

          • item: T

          Returns boolean | Promise<boolean>

    Returns AsyncSequence<T>

  • Returns a new sequence consisting of all elements that match the given predicate.

    Type Parameters

    • T

    Parameters

    • this: AsyncSequence<T>
    • predicate: ((index, value) => boolean | Promise<boolean>)
        • (index, value): boolean | Promise<boolean>
        • Parameters

          • index: number
          • value: T

          Returns boolean | Promise<boolean>

    Returns AsyncSequence<T>

  • Returns a new sequence consisting of all elements that don't match the given predicate.

    Type Parameters

    • T

    Parameters

    • this: AsyncSequence<T>
    • predicate: ((value) => boolean | Promise<boolean>)
        • (value): boolean | Promise<boolean>
        • Parameters

          • value: T

          Returns boolean | Promise<boolean>

    Returns AsyncSequence<T>

  • Returns the first element of the sequence or the first element matching predicate if present, otherwise returns null.

    Type Parameters

    • T

    Parameters

    • this: AsyncSequence<T>
    • Optional predicate: ((item) => boolean | Promise<boolean>)
        • (item): boolean | Promise<boolean>
        • Parameters

          • item: T

          Returns boolean | Promise<boolean>

    Returns Promise<null | T>

  • Returns the last element of the sequence or the last element matching predicate if present, otherwise returns null.

    Type Parameters

    • T

    Parameters

    • this: AsyncSequence<T>
    • Optional predicate: ((value) => boolean | Promise<boolean>)
        • (value): boolean | Promise<boolean>
        • Parameters

          • value: T

          Returns boolean | Promise<boolean>

    Returns Promise<null | T>

  • Returns the first element of the sequence or the first element matching predicate if present, otherwise throws an error.

    Type Parameters

    • T

    Parameters

    • this: AsyncSequence<T>
    • Optional predicate: ((item) => boolean | Promise<boolean>)
        • (item): boolean | Promise<boolean>
        • Parameters

          • item: T

          Returns boolean | Promise<boolean>

    Returns Promise<T>

  • Returns the first element of the sequence or the first element matching predicate if present, otherwise returns null.

    Type Parameters

    • T

    Parameters

    • this: AsyncSequence<T>
    • Optional predicate: ((item) => boolean | Promise<boolean>)
        • (item): boolean | Promise<boolean>
        • Parameters

          • item: T

          Returns boolean | Promise<boolean>

    Returns Promise<null | T>

  • Accumulates all elements of the sequence into a single result by applying the given operation starting with the initial value. The result of the last operation will be passed as accumulated value to the getNext invocation of the operation until all elements of the sequence are processed.

    Type Parameters

    • T
    • R

    Parameters

    • this: AsyncSequence<T>
    • initial: R
    • operation: ((acc, element) => R | Promise<R>)
        • (acc, element): R | Promise<R>
        • Parameters

          • acc: R
          • element: T

          Returns R | Promise<R>

    Returns Promise<R>

  • Accumulates all elements of the sequence into a single result by applying the given operation starting with the initial value. The result of the last operation will be passed as accumulated value to the getNext invocation of the operation as well as the index of the current element (zero-based) until all elements of the sequence are processed.

    Type Parameters

    • T
    • R

    Parameters

    • this: AsyncSequence<T>
    • initial: R
    • operation: ((index, acc, element) => R | Promise<R>)
        • (index, acc, element): R | Promise<R>
        • Parameters

          • index: number
          • acc: R
          • element: T

          Returns R | Promise<R>

    Returns Promise<R>

  • Performs the given action (side-effect) for each element of the sequence.

    Type Parameters

    • T

    Parameters

    • this: AsyncSequence<T>
    • action: ((item) => unknown)
        • (item): unknown
        • Parameters

          • item: T

          Returns unknown

    Returns Promise<void>

  • Performs the given action (side-effect) for each element of the sequence and passes the index of the current element (zero-based).

    Type Parameters

    • T

    Parameters

    • this: AsyncSequence<T>
    • action: ((index, value) => unknown)
        • (index, value): unknown
        • Parameters

          • index: number
          • value: T

          Returns unknown

    Returns Promise<void>

  • Groups all elements of the sequence into a map. Keys are determined by the given keySelector function.

    Type Parameters

    • T
    • K

    Parameters

    • this: AsyncSequence<T>
    • keySelector: ((value) => K | Promise<K>)
        • (value): K | Promise<K>
        • Parameters

          • value: T

          Returns K | Promise<K>

    Returns Promise<Map<K, T[]>>

  • Returns the zero-based index of the given element or -1 if the sequence does not contain the element.

    Type Parameters

    • T

    Parameters

    Returns Promise<number>

  • Returns the zero-based index of the first element matching the given predicate or -1 if no element matches the predicate.

    Type Parameters

    • T

    Parameters

    • this: AsyncSequence<T>
    • predicate: ((value) => boolean | Promise<boolean>)
        • (value): boolean | Promise<boolean>
        • Parameters

          • value: T

          Returns boolean | Promise<boolean>

    Returns Promise<number>

  • Returns the zero-based index of the last element matching the given predicate or -1 if no element matches the predicate.

    Type Parameters

    • T

    Parameters

    • this: AsyncSequence<T>
    • predicate: ((value) => boolean | Promise<boolean>)
        • (value): boolean | Promise<boolean>
        • Parameters

          • value: T

          Returns boolean | Promise<boolean>

    Returns Promise<number>

  • Returns true the sequence is empty

    Type Parameters

    • T

    Parameters

    Returns Promise<boolean>

  • Returns true the sequence is not empty

    Type Parameters

    • T

    Parameters

    Returns Promise<boolean>

  • Returns the last element of the sequence or the last element matching predicate if present, otherwise throws an error.

    Type Parameters

    • T

    Parameters

    • this: AsyncSequence<T>
    • Optional predicate: ((value) => boolean | Promise<boolean>)
        • (value): boolean | Promise<boolean>
        • Parameters

          • value: T

          Returns boolean | Promise<boolean>

    Returns Promise<T>

  • Returns the last element of the sequence or the last element matching predicate if present, otherwise returns null.

    Type Parameters

    • T

    Parameters

    • this: AsyncSequence<T>
    • Optional predicate: ((value) => boolean | Promise<boolean>)
        • (value): boolean | Promise<boolean>
        • Parameters

          • value: T

          Returns boolean | Promise<boolean>

    Returns Promise<null | T>

  • Transforms each element into another value by applying the given transform function and returns a new sequence.

    Type Parameters

    • S
    • T

    Parameters

    • this: AsyncSequence<S>
    • transform: ((element) => T | Promise<T>)
        • (element): T | Promise<T>
        • Parameters

          • element: S

          Returns T | Promise<T>

    Returns AsyncSequence<T>

  • Transforms each element into another value by applying the given transform function and returns a new sequence.

    Type Parameters

    • T
    • R

    Parameters

    • this: AsyncSequence<T>
    • transform: ((index, value) => R | Promise<R>)
        • (index, value): R | Promise<R>
        • Parameters

          • index: number
          • value: T

          Returns R | Promise<R>

    Returns AsyncSequence<R>

  • Transforms each element into another value by applying the given transform function and returns a new sequence. Transformations into null or undefined values are discarded.

    Type Parameters

    • T
    • R

    Parameters

    • this: AsyncSequence<T>
    • transform: ((value) => undefined | null | R | Promise<undefined | null | R>)
        • (value): undefined | null | R | Promise<undefined | null | R>
        • Parameters

          • value: T

          Returns undefined | null | R | Promise<undefined | null | R>

    Returns AsyncSequence<NonNullable<R>>

  • Returns the maximum element of the sequence or null if sequence is empty.

    Type Parameters

    • T

    Parameters

    Returns Promise<null | T>

  • Returns the maximum element by comparing the results of the given selector function for each element of the sequence or null if the sequence is empty.

    Type Parameters

    • T
    • R

    Parameters

    • this: AsyncSequence<T>
    • selector: ((value) => R | Promise<R>)
        • (value): R | Promise<R>
        • Parameters

          • value: T

          Returns R | Promise<R>

    Returns Promise<null | T>

  • Returns the maximum element of the sequence by evaluating the given compare function or null if sequence is empty.

    Type Parameters

    • T

    Parameters

    • this: AsyncSequence<T>
    • compare: ((a, b) => number | Promise<number>)
        • (a, b): number | Promise<number>
        • Parameters

          Returns number | Promise<number>

    Returns Promise<null | T>

  • Merges the elements of both sequences into a new sequence. Each element of this sequence is eventually replaced with an element of the other sequence by comparing results of the given selector function. If no value is found in the other sequence the element is retained. New elements of the other sequence are appended to the end of the new sequence or prepended to the start of the new sequence, if prependNewValues is set to true. This operation is not lazy evaluated.

    Type Parameters

    • T
    • S

    Parameters

    • this: AsyncSequence<T>
    • other: AsyncSequence<T> | AsyncIterable<T> | Iterable<T>
    • selector: ((value) => S | Promise<S>)
        • (value): S | Promise<S>
        • Parameters

          • value: T

          Returns S | Promise<S>

    • prependNewValues: boolean = false

    Returns AsyncSequence<T>

  • Returns the minimum element of the sequence or null if sequence is empty.

    Type Parameters

    • T

    Parameters

    Returns Promise<null | T>

  • Returns the minimum element by comparing the results of the given selector function for each element of the sequence or null if the sequence is empty.

    Type Parameters

    • T
    • R

    Parameters

    • this: AsyncSequence<T>
    • selector: ((value) => R | Promise<R>)
        • (value): R | Promise<R>
        • Parameters

          • value: T

          Returns R | Promise<R>

    Returns Promise<null | T>

  • Returns the minimum element of the sequence by evaluating the given compare function or null if sequence is empty.

    Type Parameters

    • T

    Parameters

    • this: AsyncSequence<T>
    • compare: ((a, b) => number | Promise<number>)
        • (a, b): number | Promise<number>
        • Parameters

          Returns number | Promise<number>

    Returns Promise<null | T>

  • Returns true if no element match the given predicate or if the sequence is empty if no predicate is present.

    Type Parameters

    • T

    Parameters

    • this: AsyncSequence<T>
    • Optional predicate: ((value) => boolean | Promise<boolean>)
        • (value): boolean | Promise<boolean>
        • Parameters

          • value: T

          Returns boolean | Promise<boolean>

    Returns Promise<boolean>

  • Performs the given action for each element and returns the sequence and passes the index of the current element (zero-based).

    Type Parameters

    • T

    Parameters

    • this: AsyncSequence<T>
    • action: ((index, value) => unknown)
        • (index, value): unknown
        • Parameters

          • index: number
          • value: T

          Returns unknown

    Returns AsyncSequence<T>

  • Evaluates the given predicate for each element of the sequence and assorts each element into one of two lists according to the result of the predicate. Returns both lists as an object.

    Type Parameters

    • T

    Parameters

    • this: AsyncSequence<T>
    • predicate: ((value) => boolean | Promise<boolean>)
        • (value): boolean | Promise<boolean>
        • Parameters

          • value: T

          Returns boolean | Promise<boolean>

    Returns Promise<{
        false: T[];
        true: T[];
    }>

  • Reduces the whole sequence to a single value by invoking operation with each element from left to right. For every invocation of the operation acc is the result of the last invocation. For the first invocation of the operation acc is the first element of the sequence.

    Type Parameters

    • S
    • T

    Parameters

    • this: AsyncSequence<T>
    • operation: ((acc, value) => S | Promise<S>)
        • (acc, value): S | Promise<S>
        • Parameters

          • acc: S
          • value: T

          Returns S | Promise<S>

    Returns Promise<S>

  • Reduces the whole sequence to a single value by invoking operation with each element from left to right. For every invocation of the operation acc is the result of the last invocation. For the first invocation of the operation acc is the first element of the sequence. In addition the index of the current element is also passed to the operation.

    Type Parameters

    • S
    • T

    Parameters

    • this: AsyncSequence<T>
    • operation: ((index, acc, element) => S | Promise<S>)
        • (index, acc, element): S | Promise<S>
        • Parameters

          • index: number
          • acc: S
          • element: T

          Returns S | Promise<S>

    Returns Promise<S>

  • Returns the single element of the sequence or throws error if the sequence has more than one element or none at all. If a predicate is passed returns the single element matching the predicate or throws an error if more or less than one element match the predicate.

    Type Parameters

    • T

    Parameters

    • this: AsyncSequence<T>
    • Optional predicate: ((value) => boolean | Promise<boolean>)
        • (value): boolean | Promise<boolean>
        • Parameters

          • value: T

          Returns boolean | Promise<boolean>

    Returns Promise<T>

  • Returns the single element of the sequence or null if the sequence has more than one element or none at all. If a predicate is passed returns the single element matching the predicate or null if more or less than one element match the predicate.

    Type Parameters

    • T

    Parameters

    • this: AsyncSequence<T>
    • Optional predicate: ((value) => boolean | Promise<boolean>)
        • (value): boolean | Promise<boolean>
        • Parameters

          • value: T

          Returns boolean | Promise<boolean>

    Returns Promise<null | T>

  • Returns the sum of all numbers.

    Parameters

    Returns Promise<number>

  • Returns the sum of all numbers specified by the given selector function.

    Type Parameters

    • T

    Parameters

    • this: AsyncSequence<T>
    • selector: ((value) => number | Promise<number>)
        • (value): number | Promise<number>
        • Parameters

          • value: T

          Returns number | Promise<number>

    Returns Promise<number>

  • Takes all elements of the sequence as long as the given predicate evaluates to true.

    Type Parameters

    • T

    Parameters

    • this: AsyncSequence<T>
    • predicate: ((item) => boolean | Promise<boolean>)
        • (item): boolean | Promise<boolean>
        • Parameters

          • item: T

          Returns boolean | Promise<boolean>

    Returns AsyncSequence<T>

  • Returns all elements of the sequence as array. If an array is passed the elements are appended to the end of the array.

    Type Parameters

    • T

    Parameters

    Returns Promise<T[]>

  • Returns all elements of the sequence as array. If an array is passed the elements are appended to the end of the array.

    Type Parameters

    • T

    Parameters

    Returns Promise<T[]>

  • Returns a map consisting of each key-value pair. If a map is passed the pairs are set on this map. Duplicate keys override each other.

    Type Parameters

    • K
    • V

    Parameters

    Returns Promise<Map<K, V>>

  • Returns a map consisting of each key-value pair. Pairs with null or undefined keys or values are discarded. If a map is passed the pairs are set on this map. Duplicate keys override each other.

    Type Parameters

    • K
    • V

    Parameters

    Returns Promise<Map<NonNullable<K>, NonNullable<V>>>

  • Returns all elements of the sequence as set. If a set is passed the elements are added to this set.

    Type Parameters

    • T

    Parameters

    Returns Promise<Set<T>>

  • Returns a pair of arrays where the first array contains all first values and the second array all second values from each input pair of the sequence.

    Type Parameters

    • T
    • S

    Parameters

    Returns Promise<[T[], S[]]>

  • Returns a new sequence consisting of pairs built the elements of both sequences with the same index. The resulting sequence has the length of the shortest input sequence. All other elements are discarded.

    Type Parameters

    • T
    • S

    Parameters

    Returns AsyncSequence<[T, S]>