AsyncQuery Class
Package: @esfx/async-iter-query
A AsyncQuery
represents a series of operations that act upon an Iterable
or ArrayLike. Evaluation of
these operations is deferred until the either a scalar value is requested from the AsyncQuery
or the
AsyncQuery
is iterated.
Declaration
export declare class AsyncQuery<T> implements AsyncIterable<T>
Constructors
constructor(source)
Creates an AsyncQuery
from an AsyncIterable
source.
Declaration
constructor(source: AsyncIterable<T> | Iterable<PromiseLike<T> | T>);
Parameters
Methods
_fromAsync(source)
Declaration
protected _fromAsync<TNode, T extends TNode>(source: AsyncOrderedHierarchyIterable<TNode, T> | OrderedHierarchyIterable<TNode, T>): AsyncOrderedHierarchyQuery<TNode, T>;
Type Parameters
- TNode
- T
Parameters
- source
- AsyncOrderedHierarchyIterable<TNode, T> | OrderedHierarchyIterable<TNode, T>
Returns
_fromAsync(source)
Declaration
protected _fromAsync<TNode, T extends TNode>(source: AsyncHierarchyIterable<TNode, T> | HierarchyIterable<TNode, T>): AsyncHierarchyQuery<TNode, T>;
Type Parameters
- TNode
- T
Parameters
- source
- AsyncHierarchyIterable<TNode, T> | HierarchyIterable<TNode, T>
Returns
_fromAsync(source, provider)
Declaration
protected _fromAsync<TNode, T extends TNode>(source: AsyncOrderedIterable<T> | OrderedIterable<T>, provider: HierarchyProvider<TNode>): AsyncOrderedHierarchyQuery<TNode, T>;
Type Parameters
- TNode
- T
Parameters
- source
- AsyncOrderedIterable<T> | OrderedIterable<T>
- provider
- HierarchyProvider<TNode>
Returns
_fromAsync(source, provider)
Declaration
protected _fromAsync<TNode, T extends TNode>(source: AsyncIterable<T> | Iterable<T>, provider: HierarchyProvider<TNode>): AsyncHierarchyQuery<TNode, T>;
Type Parameters
- TNode
- T
Parameters
- source
- AsyncIterable<T> | Iterable<T>
- provider
- HierarchyProvider<TNode>
Returns
_fromAsync(source)
Declaration
protected _fromAsync<T>(source: AsyncOrderedIterable<T> | OrderedIterable<T>): AsyncOrderedQuery<T>;
Type Parameters
- T
Parameters
- source
- AsyncOrderedIterable<T> | OrderedIterable<T>
Returns
_fromAsync(source)
Declaration
protected _fromAsync<T extends readonly unknown[] | []>(source: AsyncIterable<T> | Iterable<PromiseLike<T> | T>): AsyncQuery<T>;
Type Parameters
- T
Parameters
- source
- AsyncIterable<T> | Iterable<PromiseLike<T> | T>
Returns
_fromAsync(source)
Declaration
protected _fromAsync<T>(source: AsyncIterable<T> | Iterable<PromiseLike<T> | T>): AsyncQuery<T>;
Type Parameters
- T
Parameters
- source
- AsyncIterable<T> | Iterable<PromiseLike<T> | T>
Returns
_fromSync(source)
Declaration
protected _fromSync<TNode, T extends TNode>(source: OrderedHierarchyIterable<TNode, T>): OrderedHierarchyQuery<TNode, T>;
Type Parameters
- TNode
- T
Parameters
- source
- OrderedHierarchyIterable<TNode, T>
Returns
_fromSync(source)
Declaration
protected _fromSync<TNode, T extends TNode>(source: HierarchyIterable<TNode, T>): HierarchyQuery<TNode, T>;
Type Parameters
- TNode
- T
Parameters
- source
- HierarchyIterable<TNode, T>
Returns
_fromSync(source, provider)
Declaration
protected _fromSync<TNode, T extends TNode>(source: OrderedIterable<T>, provider: HierarchyProvider<TNode>): OrderedHierarchyQuery<TNode, T>;
Type Parameters
- TNode
- T
Parameters
- source
- OrderedIterable<T>
- provider
- HierarchyProvider<TNode>
Returns
_fromSync(source, provider)
Declaration
protected _fromSync<TNode, T extends TNode>(source: Iterable<T>, provider: HierarchyProvider<TNode>): HierarchyQuery<TNode, T>;
Type Parameters
- TNode
- T
Parameters
- source
- Iterable<T>
- provider
- HierarchyProvider<TNode>
Returns
_fromSync(source)
Declaration
protected _fromSync<T>(source: OrderedIterable<T>): OrderedQuery<T>;
Type Parameters
- T
Parameters
- source
- OrderedIterable<T>
Returns
_fromSync(source)
Declaration
protected _fromSync<T extends readonly unknown[] | []>(source: Iterable<T>): Query<T>;
Type Parameters
- T
Parameters
- source
- Iterable<T>
Returns
_fromSync(source)
Declaration
protected _fromSync<T>(source: Iterable<T>): Query<T>;
Type Parameters
- T
Parameters
- source
- Iterable<T>
Returns
[Symbol.asyncIterator]()
Declaration
[Symbol.asyncIterator](): AsyncIterator<T>;
Returns
append(value)
Creates a subquery for the elements of this AsyncQuery
with the provided value appended to the end.
Declaration
append(value: PromiseLike<T> | T): AsyncUnorderedQueryFlow<this, T>;
Parameters
Returns
average()
Computes the average for a series of numbers.
Scalar
Declaration
average(): Promise<T extends number ? number : never>;
Returns
average(elementSelector)
Computes the average for a series of numbers.
Scalar
Declaration
average(elementSelector: (element: T) => PromiseLike<number> | number): Promise<number>;
Parameters
- elementSelector
- (element: T) => PromiseLike<number> | number
Returns
break(predicate)
Creates a tuple whose first element is a subquery containing the first span of elements that do not match the supplied predicate, and whose second element is a subquery containing the remaining elements.
The first subquery is eagerly evaluated, while the second subquery is lazily evaluated.
NOTE: This is an alias for spanUntil
.
Declaration
break(predicate: (element: T, offset: number) => PromiseLike<boolean> | boolean): Promise<[UnorderedQueryFlow<this, T>, AsyncUnorderedQueryFlow<this, T>]>;
Parameters
- predicate
- (element: T, offset: number) => PromiseLike<boolean> | boolean
The predicate used to match elements. Scalar
Returns
concat(right)
Creates a subquery that concatenates this AsyncQuery
with another AsyncIterable
or Iterable
.
Declaration
concat<R extends AsyncIterable<T> | Iterable<PromiseLike<T> | T>>(right: R): AsyncMergeQueryFlow<this, R, T>;
Type Parameters
- R
Parameters
- right
- R
An AsyncIterable
or Iterable
object.
Subquery
Returns
concat(right)
Creates a subquery that concatenates this AsyncQuery
with another AsyncIterable
or Iterable
.
Declaration
concat(right: AsyncIterable<T> | Iterable<PromiseLike<T> | T>): AsyncQuery<T>;
Parameters
Returns
consume(iterator, options)
Creates a AsyncQuery
that, when iterated, consumes the provided AsyncIterator
.
Declaration
static consume<T>(iterator: AsyncIterator<T>, options?: ConsumeAsyncOptions): AsyncQuery<T>;
Type Parameters
- T
Parameters
- options
- ConsumeAsyncOptions
Returns
continuous(value)
Creates a AsyncQuery
that repeats the provided value forever.
Declaration
static continuous<T>(value: PromiseLike<T> | T): AsyncQuery<T>;
Type Parameters
- T
Parameters
Returns
copyTo(dest, start, count)
Writes each element to a destination. The destination must already have enough space to write the requested number of elements (i.e. arrays are *not* resized).
Declaration
copyTo<U extends IndexedCollection<T> | T[]>(dest: U, start?: number, count?: number): Promise<U>;
Type Parameters
- U
Parameters
- dest
- U
The destination array.
Returns
corresponds(right, equaler)
Computes a scalar value indicating whether every element in this AsyncQuery
corresponds to a matching element
in another AsyncIterable
or Iterable
at the same position.
Declaration
corresponds(right: AsyncIterable<T> | Iterable<PromiseLike<T> | T>, equaler?: EqualityComparison<T> | Equaler<T>): Promise<boolean>;
Parameters
- equaler
- EqualityComparison<T> | Equaler<T>
An optional callback used to compare the equality of two elements. Scalar
Returns
corresponds(right, equaler)
Computes a scalar value indicating whether every element in this AsyncQuery
corresponds to a matching element
in another AsyncIterable
or Iterable
at the same position.
Declaration
corresponds<U>(right: AsyncIterable<U> | Iterable<PromiseLike<U> | U>, equaler: (left: T, right: U) => boolean): Promise<boolean>;
Type Parameters
- U
Parameters
- equaler
- (left: T, right: U) => boolean
An optional callback used to compare the equality of two elements. Scalar
Returns
correspondsBy(right, keySelector, keyEqualer)
Computes a scalar value indicating whether every element in this AsyncQuery
corresponds to a matching element
in another AsyncIterable
or Iterable
at the same position.
Declaration
correspondsBy<K>(right: AsyncIterable<T> | Iterable<PromiseLike<T> | T>, keySelector: (element: T) => K, keyEqualer?: Equaler<K>): Promise<boolean>;
Type Parameters
- K
Parameters
- keySelector
- (element: T) => K
A callback used to select the key for each element.
Returns
correspondsBy(right, leftKeySelector, rightKeySelector, keyEqualer)
Computes a scalar value indicating whether the key for every element in this AsyncQuery
corresponds to a matching key
in right
at the same position.
Declaration
correspondsBy<U, K>(right: AsyncIterable<U> | Iterable<PromiseLike<U> | U>, leftKeySelector: (element: T) => K, rightKeySelector: (element: U) => K, keyEqualer?: EqualityComparison<K> | Equaler<K>): Promise<boolean>;
Type Parameters
- U
- K
Parameters
- leftKeySelector
- (element: T) => K
A callback used to select the key for each element in this AsyncQuery
.
- rightKeySelector
- (element: U) => K
A callback used to select the key for each element in right
.
- keyEqualer
- EqualityComparison<K> | Equaler<K>
An optional callback used to compare the equality of two keys. Scalar
Returns
count(predicate)
Counts the number of elements in the AsyncQuery
, optionally filtering elements using the supplied
callback.
Declaration
count(predicate?: (element: T) => PromiseLike<boolean> | boolean): Promise<number>;
Parameters
- predicate
- (element: T) => PromiseLike<boolean> | boolean
An optional callback used to match each element. Scalar
Returns
defaultIfEmpty(defaultValue)
Creates a subquery that contains the provided default value if this AsyncQuery
contains no elements.
Declaration
defaultIfEmpty(defaultValue: PromiseLike<T> | T): AsyncUnorderedQueryFlow<this, T>;
Parameters
Returns
distinct(equaler)
Creates a subquery for the distinct elements of this AsyncQuery
.
Declaration
distinct(equaler?: Equaler<T>): AsyncUnorderedQueryFlow<this, T>;
Parameters
Returns
distinctBy(keySelector, keyEqualer)
Creates a subquery for the distinct elements of this AsyncQuery
.
Declaration
distinctBy<K>(keySelector: (value: T) => K, keyEqualer?: Equaler<K>): AsyncUnorderedQueryFlow<this, T>;
Type Parameters
- K
Parameters
- keySelector
- (value: T) => K
A callback used to select the key to determine uniqueness.
Returns
drop(count)
Creates a subquery containing all elements except the first elements up to the supplied count.
Declaration
drop(count: number): AsyncUnorderedQueryFlow<this, T>;
Parameters
Returns
dropRight(count)
Creates a subquery containing all elements except the last elements up to the supplied count.
Declaration
dropRight(count: number): AsyncUnorderedQueryFlow<this, T>;
Parameters
Returns
dropUntil(predicate)
Creates a subquery containing all elements except the first elements that don't match the supplied predicate.
Declaration
dropUntil(predicate: (element: T) => PromiseLike<boolean> | boolean): AsyncUnorderedQueryFlow<this, T>;
Parameters
Returns
dropWhile(predicate)
Creates a subquery containing all elements except the first elements that match the supplied predicate.
Declaration
dropWhile(predicate: (element: T) => PromiseLike<boolean> | boolean): AsyncUnorderedQueryFlow<this, T>;
Parameters
Returns
elementAt(offset)
Finds the value in the AsyncQuery
at the provided offset. A negative offset starts from the
last element.
Declaration
elementAt(offset: number | Index): Promise<T | undefined>;
Parameters
Returns
empty()
Creates a AsyncQuery
with no elements.
Query
Declaration
static empty<T>(): AsyncQuery<T>;
Type Parameters
- T
Returns
endsWith(right, equaler)
Computes a scalar value indicating whether the elements of this AsyncQuery
end
with the same sequence of elements in another AsyncIterable
or Iterable
.
Declaration
endsWith(right: AsyncIterable<T> | Iterable<PromiseLike<T> | T>, equaler?: EqualityComparison<T> | Equaler<T>): Promise<boolean>;
Parameters
- equaler
- EqualityComparison<T> | Equaler<T>
A callback used to compare the equality of two elements. Scalar
Returns
endsWith(right, equaler)
Computes a scalar value indicating whether the elements of this AsyncQuery
end
with the same sequence of elements in another AsyncIterable
or Iterable
.
Declaration
endsWith<U>(right: AsyncIterable<U> | Iterable<PromiseLike<U> | U>, equaler: (left: T, right: U) => boolean): Promise<boolean>;
Type Parameters
- U
Parameters
- equaler
- (left: T, right: U) => boolean
A callback used to compare the equality of two elements. Scalar
Returns
every(predicate)
Computes a scalar value indicating whether all elements of the AsyncQuery
match the supplied callback.
Declaration
every(predicate: (element: T) => PromiseLike<boolean> | boolean): Promise<boolean>;
Parameters
- predicate
- (element: T) => PromiseLike<boolean> | boolean
A callback used to match each element. Scalar
Returns
except(right, equaler)
Creates a subquery for the set difference between this and another AsyncIterable
or Iterable
.
Declaration
except(right: AsyncIterable<T> | Iterable<PromiseLike<T> | T>, equaler?: Equaler<T>): AsyncUnorderedQueryFlow<this, T>;
Parameters
Returns
exceptBy(right, keySelector, keyEqualer)
Creates a subquery for the set difference between this and another AsyncIterable
or Iterable
, where set identity is determined by the selected key.
Declaration
exceptBy<K>(right: AsyncIterable<T> | Iterable<PromiseLike<T> | T>, keySelector: (element: T) => K, keyEqualer?: Equaler<K>): AsyncUnorderedQueryFlow<this, T>;
Type Parameters
- K
Parameters
- keySelector
- (element: T) => K
A callback used to select the key for each element.
Returns
exclude(values)
Creates a subquery with every instance of the specified value removed.
Declaration
exclude(...values: [PromiseLike<T> | T, ...(PromiseLike<T> | T)[]]): AsyncUnorderedQueryFlow<this, T>;
Parameters
Returns
filter(predicate)
Creates a subquery whose elements match the supplied predicate.
Declaration
filter<U extends T>(predicate: (element: T, offset: number) => element is U): AsyncUnorderedQueryFlow<this, U>;
Type Parameters
- U
Parameters
- predicate
- (element: T, offset: number) => element is U
A callback used to match each element.
Returns
filter(predicate)
Creates a subquery whose elements match the supplied predicate.
Declaration
filter(predicate: (element: T, offset: number) => PromiseLike<boolean> | boolean): AsyncUnorderedQueryFlow<this, T>;
Parameters
- predicate
- (element: T, offset: number) => PromiseLike<boolean> | boolean
A callback used to match each element.
Returns
filterBy(keySelector, predicate)
Creates a subquery where the selected key for each element matches the supplied predicate.
Declaration
filterBy<K>(keySelector: (element: T) => K, predicate: (key: K, offset: number) => PromiseLike<boolean> | boolean): AsyncUnorderedQueryFlow<this, T>;
Type Parameters
- K
Parameters
- keySelector
- (element: T) => K
A callback used to select the key for each element.
- predicate
- (key: K, offset: number) => PromiseLike<boolean> | boolean
A callback used to match each key.
Returns
filterDefined()
Creates a subquery whose elements are neither null
nor undefined
.
Subquery
Declaration
filterDefined(): AsyncUnorderedQueryFlow<this, NonNullable<T>>;
Returns
filterDefinedBy(keySelector)
Creates a subquery where the selected key for each element is neither null
nor undefined
.
Declaration
filterDefinedBy<K>(keySelector: (element: T) => K): AsyncUnorderedQueryFlow<this, T>;
Type Parameters
- K
Parameters
- keySelector
- (element: T) => K
A callback used to select the key for each element.
Returns
filterNot(predicate)
Creates a subquery whose elements do not match the supplied predicate.
Declaration
filterNot<U extends T>(predicate: (element: T, offset: number) => element is U): AsyncUnorderedQueryFlow<this, U>;
Type Parameters
- U
Parameters
- predicate
- (element: T, offset: number) => element is U
A callback used to match each element.
Returns
filterNot(predicate)
Creates a subquery whose elements do not match the supplied predicate.
Declaration
filterNot(predicate: (element: T, offset: number) => PromiseLike<boolean> | boolean): AsyncUnorderedQueryFlow<this, T>;
Parameters
- predicate
- (element: T, offset: number) => PromiseLike<boolean> | boolean
A callback used to match each element.
Returns
filterNotBy(keySelector, predicate)
Creates a subquery where the selected key for each element does not match the supplied predicate.
Declaration
filterNotBy<K>(keySelector: (element: T) => K, predicate: (key: K, offset: number) => PromiseLike<boolean> | boolean): AsyncUnorderedQueryFlow<this, T>;
Type Parameters
- K
Parameters
- keySelector
- (element: T) => K
A callback used to select the key for each element.
- predicate
- (key: K, offset: number) => PromiseLike<boolean> | boolean
A callback used to match each key.
Returns
filterNotDefinedBy(keySelector)
Creates a subquery where the selected key for each element is either null
or undefined
.
Declaration
filterNotDefinedBy<K>(keySelector: (element: T) => K): AsyncUnorderedQueryFlow<this, T>;
Type Parameters
- K
Parameters
- keySelector
- (element: T) => K
A callback used to select the key for each element.
Returns
first(predicate)
Gets the first element in the AsyncQuery
, optionally filtering elements using the supplied
callback.
Declaration
first<U extends T>(predicate: (element: T) => element is U): Promise<U | undefined>;
Type Parameters
- U
Parameters
- predicate
- (element: T) => element is U
An optional callback used to match each element. Scalar
Returns
first(predicate)
Gets the first element in the AsyncQuery
, optionally filtering elements using the supplied
callback.
Declaration
first(predicate?: (element: T) => PromiseLike<boolean> | boolean): Promise<T | undefined>;
Parameters
- predicate
- (element: T) => PromiseLike<boolean> | boolean
An optional callback used to match each element. Scalar
Returns
flatMap(projection)
Creates a subquery that iterates the results of applying a callback to each element.
Declaration
flatMap<U>(projection: (element: T) => AsyncIterable<U> | Iterable<PromiseLike<U> | U>): AsyncQuery<U>;
Type Parameters
- U
Parameters
- projection
- (element: T) => AsyncIterable<U> | Iterable<PromiseLike<U> | U>
A callback used to map each element into an AsyncIterable
or Iterable
object.
Returns
flatMap(projection, resultSelector)
Creates a subquery that iterates the results of applying a callback to each element.
Declaration
flatMap<U, R>(projection: (element: T) => AsyncIterable<U> | Iterable<PromiseLike<U> | U>, resultSelector: (element: T, innerElement: U) => PromiseLike<R> | R): AsyncQuery<R>;
Type Parameters
- U
- R
Parameters
- projection
- (element: T) => AsyncIterable<U> | Iterable<PromiseLike<U> | U>
A callback used to map each element into an AsyncIterable
or Iterable
object.
- resultSelector
- (element: T, innerElement: U) => PromiseLike<R> | R
An optional callback used to map the outer and projected inner elements.
Returns
forEach(callback)
Invokes a callback for each element of the AsyncQuery
.
Declaration
forEach(callback: (element: T, offset: number) => void | PromiseLike<void>): Promise<void>;
Parameters
Returns
from(source)
Creates an AsyncQuery
from an AsyncIterable
or Iterable
source.
Query
Declaration
static from<TNode, T extends TNode>(source: AsyncOrderedHierarchyIterable<TNode, T> | OrderedHierarchyIterable<TNode, T>): AsyncOrderedHierarchyQuery<TNode, T>;
Type Parameters
- TNode
- T
Parameters
- source
- AsyncOrderedHierarchyIterable<TNode, T> | OrderedHierarchyIterable<TNode, T>
Returns
from(source)
Declaration
static from<TNode, T extends TNode>(source: AsyncHierarchyIterable<TNode, T> | HierarchyIterable<TNode, T>): AsyncHierarchyQuery<TNode, T>;
Type Parameters
- TNode
- T
Parameters
- source
- AsyncHierarchyIterable<TNode, T> | HierarchyIterable<TNode, T>
Returns
from(source, provider)
Declaration
static from<TNode, T extends TNode>(source: AsyncOrderedIterable<T> | OrderedIterable<T>, provider: HierarchyProvider<TNode>): AsyncOrderedHierarchyQuery<TNode, T>;
Type Parameters
- TNode
- T
Parameters
- source
- AsyncOrderedIterable<T> | OrderedIterable<T>
- provider
- HierarchyProvider<TNode>
Returns
from(source, provider)
Declaration
static from<TNode, T extends TNode>(source: AsyncIterable<T> | Iterable<T>, provider: HierarchyProvider<TNode>): AsyncHierarchyQuery<TNode, T>;
Type Parameters
- TNode
- T
Parameters
- source
- AsyncIterable<T> | Iterable<T>
- provider
- HierarchyProvider<TNode>
Returns
from(source)
Declaration
static from<T>(source: AsyncOrderedIterable<T> | OrderedIterable<T>): AsyncOrderedQuery<T>;
Type Parameters
- T
Parameters
- source
- AsyncOrderedIterable<T> | OrderedIterable<T>
Returns
from(source)
Declaration
static from<T extends readonly unknown[] | []>(source: AsyncIterable<T> | Iterable<PromiseLike<T> | T>): AsyncQuery<T>;
Type Parameters
- T
Parameters
- source
- AsyncIterable<T> | Iterable<PromiseLike<T> | T>
Returns
from(source)
Declaration
static from<T>(source: AsyncIterable<T> | Iterable<PromiseLike<T> | T>): AsyncQuery<T>;
Type Parameters
- T
Parameters
- source
- AsyncIterable<T> | Iterable<PromiseLike<T> | T>
Returns
fullJoin(inner, outerKeySelector, innerKeySelector, resultSelector, keyEqualer)
Creates a subquery for the correlated elements of this AsyncQuery
and another AsyncIterable
or Iterable
.
Declaration
fullJoin<I, K, R>(inner: AsyncIterable<I> | Iterable<PromiseLike<I> | I>, outerKeySelector: (element: T) => K, innerKeySelector: (element: I) => K, resultSelector: (outer: T | undefined, inner: I | undefined) => PromiseLike<R> | R, keyEqualer?: Equaler<K>): AsyncQuery<R>;
Type Parameters
- I
- K
- R
Parameters
- outerKeySelector
- (element: T) => K
A callback used to select the key for an element in this AsyncQuery
.
- innerKeySelector
- (element: I) => K
A callback used to select the key for an element in the other Iterable.
- resultSelector
- (outer: T | undefined, inner: I | undefined) => PromiseLike<R> | R
A callback used to select the result for the correlated elements.
Returns
generate(count, generator)
Creates a AsyncQuery
whose values are provided by a callback executed a provided number of
times.
Declaration
static generate<T>(count: number, generator: (offset: number) => PromiseLike<T> | T): AsyncQuery<T>;
Type Parameters
- T
Parameters
Returns
groupBy(keySelector, keyEqualer)
Groups each element of this AsyncQuery
by its key.
Declaration
groupBy<K>(keySelector: (element: T) => K, keyEqualer?: Equaler<K>): AsyncGroupedQueryFlow<this, K, T>;
Type Parameters
- K
Parameters
- keySelector
- (element: T) => K
A callback used to select the key for an element.
Returns
groupBy(keySelector, elementSelector, keyEqualer)
Groups each element by its key.
Declaration
groupBy<K, V>(keySelector: (element: T) => K, elementSelector: (element: T) => PromiseLike<V> | V, keyEqualer?: Equaler<K>): AsyncGroupedQueryFlow<this, K, V>;
Type Parameters
- K
- V
Parameters
- keySelector
- (element: T) => K
A callback used to select the key for an element.
- elementSelector
- (element: T) => PromiseLike<V> | V
A callback used to select a value for an element.
Returns
groupBy(keySelector, elementSelector, resultSelector, keyEqualer)
Groups each element by its key.
Declaration
groupBy<K, V, R>(keySelector: (element: T) => K, elementSelector: (element: T) => PromiseLike<V> | V, resultSelector: (key: K, elements: Query<V>) => PromiseLike<R> | R, keyEqualer?: Equaler<K>): AsyncQuery<R>;
Type Parameters
- K
- V
- R
Parameters
- keySelector
- (element: T) => K
A callback used to select the key for an element.
- elementSelector
- (element: T) => PromiseLike<V> | V
A callback used to select a value for an element.
- resultSelector
- (key: K, elements: Query<V>) => PromiseLike<R> | R
A callback used to select a result from a group.
Returns
groupBy(keySelector, elementSelector, resultSelector, keyEqualer)
Groups each element by its key.
Declaration
groupBy<K, R>(keySelector: (element: T) => K, elementSelector: undefined, resultSelector: (key: K, elements: Query<T>) => PromiseLike<R> | R, keyEqualer?: Equaler<K>): AsyncQuery<R>;
Type Parameters
- K
- R
Parameters
- keySelector
- (element: T) => K
A callback used to select the key for an element.
- resultSelector
- (key: K, elements: Query<T>) => PromiseLike<R> | R
A callback used to select a result from a group.
Returns
groupJoin(inner, outerKeySelector, innerKeySelector, resultSelector, keyEqualer)
Creates a grouped subquery for the correlated elements of this AsyncQuery
and another AsyncIterable
or Iterable
object.
Declaration
groupJoin<I, K, R>(inner: AsyncIterable<I> | Iterable<PromiseLike<I> | I>, outerKeySelector: (element: T) => K, innerKeySelector: (element: I) => K, resultSelector: (outer: T, inner: Query<I>) => PromiseLike<R> | R, keyEqualer?: Equaler<K>): AsyncQuery<R>;
Type Parameters
- I
- K
- R
Parameters
- outerKeySelector
- (element: T) => K
A callback used to select the key for an element in this AsyncQuery
.
- innerKeySelector
- (element: I) => K
A callback used to select the key for an element in the other Iterable
object.
- resultSelector
- (outer: T, inner: Query<I>) => PromiseLike<R> | R
A callback used to select the result for the correlated elements.
Returns
includes(value, equaler)
Computes a scalar value indicating whether the provided value is included in the AsyncQuery
.
Declaration
includes(value: T, equaler?: EqualityComparison<T> | Equaler<T>): Promise<boolean>;
Parameters
- value
- T
A value.
- equaler
- EqualityComparison<T> | Equaler<T>
An optional callback used to compare the equality of two elements. Scalar
Returns
includes(value, equaler)
Computes a scalar value indicating whether the provided value is included in the AsyncQuery
.
Declaration
includes<U>(value: U, equaler: (left: T, right: U) => boolean): Promise<boolean>;
Type Parameters
- U
Parameters
- value
- U
A value.
- equaler
- (left: T, right: U) => boolean
An optional callback used to compare the equality of two elements. Scalar
Returns
includesSequence(right, equaler)
Computes a scalar value indicating whether the elements of this AsyncQuery
include
an exact sequence of elements from another AsyncIterable
or Iterable
.
Declaration
includesSequence(right: AsyncIterable<T> | Iterable<PromiseLike<T> | T>, equaler?: EqualityComparison<T> | Equaler<T>): Promise<boolean>;
Parameters
- equaler
- EqualityComparison<T> | Equaler<T>
A callback used to compare the equality of two elements. Scalar
Returns
includesSequence(right, equaler)
Computes a scalar value indicating whether the elements of this AsyncQuery
include
an exact sequence of elements from another AsyncIterable
or Iterable
.
Declaration
includesSequence<U>(right: AsyncIterable<U> | Iterable<PromiseLike<U> | U>, equaler: (left: T, right: U) => boolean): Promise<boolean>;
Type Parameters
- U
Parameters
- equaler
- (left: T, right: U) => boolean
A callback used to compare the equality of two elements. Scalar
Returns
intersect(right, equaler)
Creates a subquery for the set intersection of this AsyncQuery
and another AsyncIterable
or Iterable
.
Declaration
intersect<R extends AsyncIterable<T> | Iterable<PromiseLike<T> | T>>(right: R, equaler?: Equaler<T>): AsyncMergeQueryFlow<this, R, T>;
Type Parameters
- R
Parameters
- right
- R
An AsyncIterable
or Iterable
object.
Returns
intersect(right, equaler)
Creates a subquery for the set intersection of this AsyncQuery
and another AsyncIterable
or Iterable
.
Declaration
intersect(right: AsyncIterable<T> | Iterable<PromiseLike<T> | T>, equaler?: Equaler<T>): AsyncQuery<T>;
Parameters
Returns
intersectBy(right, keySelector, keyEqualer)
Creates a subquery for the set intersection of this AsyncQuery
and another AsyncIterable
or Iterable
, where set identity is determined by the selected key.
Declaration
intersectBy<K, R extends AsyncIterable<T> | Iterable<PromiseLike<T> | T>>(right: R, keySelector: (element: T) => K, keyEqualer?: Equaler<K>): AsyncMergeQueryFlow<this, R, T>;
Type Parameters
- K
- R
Parameters
- right
- R
An AsyncIterable
or Iterable
object.
- keySelector
- (element: T) => K
A callback used to select the key for each element.
Returns
intersectBy(right, keySelector, keyEqualer)
Creates a subquery for the set intersection of this AsyncQuery
and another AsyncIterable
or Iterable
, where set identity is determined by the selected key.
Declaration
intersectBy<K>(right: AsyncIterable<T> | Iterable<PromiseLike<T> | T>, keySelector: (element: T) => K, keyEqualer?: Equaler<K>): AsyncQuery<T>;
Type Parameters
- K
Parameters
- keySelector
- (element: T) => K
A callback used to select the key for each element.
Returns
into(callback)
Pass the entire AsyncQuery
to the provided callback, returning the result.
Declaration
into<R>(callback: (source: this) => R): R;
Type Parameters
- R
Parameters
- callback
- (source: this) => R
A callback function.
Returns
join(inner, outerKeySelector, innerKeySelector, resultSelector, keyEqualer)
Creates a subquery for the correlated elements of this AsyncQuery
and another AsyncIterable
or Iterable
.
Declaration
join<I, K, R>(inner: AsyncIterable<I> | Iterable<PromiseLike<I> | I>, outerKeySelector: (element: T) => K, innerKeySelector: (element: I) => K, resultSelector: (outer: T, inner: I) => PromiseLike<R> | R, keyEqualer?: Equaler<K>): AsyncQuery<R>;
Type Parameters
- I
- K
- R
Parameters
- outerKeySelector
- (element: T) => K
A callback used to select the key for an element in this AsyncQuery
.
- innerKeySelector
- (element: I) => K
A callback used to select the key for an element in the other Iterable.
- resultSelector
- (outer: T, inner: I) => PromiseLike<R> | R
A callback used to select the result for the correlated elements.
Returns
last(predicate)
Gets the last element in the AsyncQuery
, optionally filtering elements using the supplied
callback.
Declaration
last<U extends T>(predicate: (element: T) => element is U): Promise<U | undefined>;
Type Parameters
- U
Parameters
- predicate
- (element: T) => element is U
An optional callback used to match each element. Scalar
Returns
last(predicate)
Gets the last element in the AsyncQuery
, optionally filtering elements using the supplied
callback.
Declaration
last(predicate?: (element: T) => PromiseLike<boolean> | boolean): Promise<T | undefined>;
Parameters
- predicate
- (element: T) => PromiseLike<boolean> | boolean
An optional callback used to match each element. Scalar
Returns
map(selector)
Creates a subquery by applying a callback to each element.
Declaration
map<U>(selector: (element: T, offset: number) => PromiseLike<U> | U): AsyncQuery<U>;
Type Parameters
- U
Parameters
Returns
materialize()
Eagerly evaluate the AsyncQuery
, returning a new AsyncQuery
.
Subquery
Declaration
materialize(): AsyncUnorderedQueryFlow<this, T>;
Returns
max(comparer)
Gets the maximum element in the AsyncQuery
, optionally comparing elements using the supplied
callback.
Declaration
max(comparer?: Comparison<T> | Comparer<T>): Promise<T | undefined>;
Parameters
Returns
maxBy(keySelector, keyComparer)
Gets the maximum element by its key in the AsyncQuery
, optionally comparing the keys of each element using the supplied callback.
Declaration
maxBy<K>(keySelector: (element: T) => K, keyComparer?: Comparison<K> | Comparer<K>): Promise<T | undefined>;
Type Parameters
- K
Parameters
- keySelector
- (element: T) => K
A callback used to choose the key to compare.
Returns
min(comparer)
Gets the minimum element in the AsyncQuery
, optionally comparing elements using the supplied
callback.
Declaration
min(comparer?: Comparison<T> | Comparer<T>): Promise<T | undefined>;
Parameters
Returns
minBy(keySelector, keyComparer)
Gets the minimum element by its key in the AsyncQuery
, optionally comparing the keys of each element using the supplied callback.
Declaration
minBy<K>(keySelector: (element: T) => K, keyComparer?: Comparison<K> | Comparer<K>): Promise<T | undefined>;
Type Parameters
- K
Parameters
- keySelector
- (element: T) => K
A callback used to choose the key to compare.
Returns
nth(offset)
Finds the value in the AsyncQuery
at the provided offset. A negative offset starts from the
last element.
NOTE: This is an alias for elementAt
.
Declaration
nth(offset: number | Index): Promise<T | undefined>;
Parameters
Returns
of(elements)
Creates a AsyncQuery
for the provided elements.
Declaration
static of<T>(...elements: (PromiseLike<T> | T)[]): AsyncQuery<T>;
Type Parameters
- T
Parameters
Returns
once(value)
Creates a AsyncQuery
over a single element.
Declaration
static once<T>(value: PromiseLike<T> | T): AsyncQuery<T>;
Type Parameters
- T
Parameters
Returns
orderBy(keySelector, comparer)
Creates an ordered subquery whose elements are sorted in ascending order by the provided key.
Declaration
orderBy<K>(keySelector: (element: T) => K, comparer?: Comparison<K> | Comparer<K>): AsyncOrderedQueryFlow<this, T>;
Type Parameters
- K
Parameters
- keySelector
- (element: T) => K
A callback used to select the key for an element.
Returns
orderByDescending(keySelector, comparer)
Creates an ordered subquery whose elements are sorted in descending order by the provided key.
Declaration
orderByDescending<K>(keySelector: (element: T) => K, comparer?: Comparison<K> | Comparer<K>): AsyncOrderedQueryFlow<this, T>;
Type Parameters
- K
Parameters
- keySelector
- (element: T) => K
A callback used to select the key for an element.
Returns
pageBy(pageSize)
Creates a subquery that splits this AsyncQuery
into one or more pages.
While advancing from page to page is evaluated lazily, the elements of the page are
evaluated eagerly.
Declaration
pageBy(pageSize: number): AsyncPagedQueryFlow<this, T>;
Parameters
Returns
pageBy(pageSize, pageSelector)
Creates a subquery that splits this AsyncQuery
into one or more pages.
While advancing from page to page is evaluated lazily, the elements of the page are
evaluated eagerly.
Declaration
pageBy<R>(pageSize: number, pageSelector: (page: number, offset: number, values: UnorderedQueryFlow<this, T>) => R): AsyncQuery<R>;
Type Parameters
- R
Parameters
- pageSelector
- (page: number, offset: number, values: UnorderedQueryFlow<this, T>) => R
Returns
patch(start, skipCount, range)
Creates a subquery for the elements of this AsyncQuery
with the provided range
patched into the results.
Declaration
patch(start: number, skipCount?: number, range?: AsyncIterable<T> | Iterable<PromiseLike<T> | T>): AsyncUnorderedQueryFlow<this, T>;
Parameters
Returns
prepend(value)
Creates a subquery for the elements of this AsyncQuery
with the provided value prepended to the beginning.
Declaration
prepend(value: PromiseLike<T> | T): AsyncUnorderedQueryFlow<this, T>;
Parameters
Returns
range(start, end, increment)
Creates a AsyncQuery
over a range of numbers.
Declaration
static range(start: number, end: number, increment?: number): AsyncQuery<number>;
Parameters
Returns
reduce(accumulator)
Computes a scalar value by applying an accumulator callback over each element.
Declaration
reduce(accumulator: (current: T, element: T, offset: number) => PromiseLike<T> | T): Promise<T>;
Parameters
- accumulator
- (current: T, element: T, offset: number) => PromiseLike<T> | T
the callback used to compute the result.
Returns
reduce(accumulator, seed, resultSelector)
Computes a scalar value by applying an accumulator callback over each element.
Declaration
reduce<U>(accumulator: (current: U, element: T, offset: number) => PromiseLike<U>, seed: U, resultSelector?: (result: U, count: number) => PromiseLike<U> | U): Promise<U>;
Type Parameters
- U
Parameters
- accumulator
- (current: U, element: T, offset: number) => PromiseLike<U>
the callback used to compute the result.
- seed
- U
An optional seed value. Scalar
- resultSelector
- (result: U, count: number) => PromiseLike<U> | U
Returns
reduce(accumulator, seed, resultSelector)
Computes a scalar value by applying an accumulator callback over each element.
Declaration
reduce<U, R>(accumulator: (current: U, element: T, offset: number) => PromiseLike<U> | U, seed: U, resultSelector: (result: U, count: number) => PromiseLike<R> | R): Promise<R>;
Type Parameters
- U
- R
Parameters
- accumulator
- (current: U, element: T, offset: number) => PromiseLike<U> | U
the callback used to compute the result.
- seed
- U
An optional seed value.
- resultSelector
- (result: U, count: number) => PromiseLike<R> | R
An optional callback used to compute the final result. Scalar
Returns
reduceRight(accumulator)
Computes a scalar value by applying an accumulator callback over each element in reverse.
Declaration
reduceRight(accumulator: (current: T, element: T, offset: number) => PromiseLike<T> | T): Promise<T>;
Parameters
- accumulator
- (current: T, element: T, offset: number) => PromiseLike<T> | T
the callback used to compute the result. Scalar
Returns
reduceRight(accumulator, seed, resultSelector)
Computes a scalar value by applying an accumulator callback over each element in reverse.
Declaration
reduceRight<U>(accumulator: (current: U, element: T, offset: number) => PromiseLike<U> | U, seed: U, resultSelector?: (result: U, count: number) => PromiseLike<U> | U): Promise<U>;
Type Parameters
- U
Parameters
- accumulator
- (current: U, element: T, offset: number) => PromiseLike<U> | U
the callback used to compute the result.
- seed
- U
An optional seed value. Scalar
- resultSelector
- (result: U, count: number) => PromiseLike<U> | U
Returns
reduceRight(accumulator, seed, resultSelector)
Computes a scalar value by applying an accumulator callback over each element in reverse.
Declaration
reduceRight<U, R>(accumulator: (current: U, element: T, offset: number) => PromiseLike<U> | U, seed: U, resultSelector: (result: U, count: number) => PromiseLike<R> | R): Promise<R>;
Type Parameters
- U
- R
Parameters
- accumulator
- (current: U, element: T, offset: number) => PromiseLike<U> | U
the callback used to compute the result.
- seed
- U
An optional seed value.
- resultSelector
- (result: U, count: number) => PromiseLike<R> | R
An optional callback used to compute the final result. Scalar
Returns
relativeComplement(right, equaler)
Creates a subquery for the set difference between this and another AsyncIterable
or Iterable
.
NOTE: This is an alias for except
.
Declaration
relativeComplement(right: AsyncIterable<T> | Iterable<PromiseLike<T> | T>, equaler?: Equaler<T>): AsyncUnorderedQueryFlow<this, T>;
Parameters
Returns
relativeComplementBy(right, keySelector, keyEqualer)
Creates a subquery for the set difference between this and another AsyncIterable
or Iterable
, where set identity is determined by the selected key.
NOTE: This is an alias for exceptBy
.
Declaration
relativeComplementBy<K>(right: AsyncIterable<T> | Iterable<PromiseLike<T> | T>, keySelector: (element: T) => K, keyEqualer?: Equaler<K>): AsyncUnorderedQueryFlow<this, T>;
Type Parameters
- K
Parameters
- keySelector
- (element: T) => K
A callback used to select the key for each element.
Returns
repeat(value, count)
Creates a AsyncQuery
for a value repeated a provided number of times.
Declaration
static repeat<T>(value: PromiseLike<T> | T, count: number): AsyncQuery<T>;
Type Parameters
- T
Parameters
Returns
reverse()
Creates a subquery whose elements are in the reverse order.
Subquery
Declaration
reverse(): AsyncUnorderedQueryFlow<this, T>;
Returns
scan(accumulator)
Creates a subquery containing the cumulative results of applying the provided callback to each element.
Declaration
scan(accumulator: (current: T, element: T, offset: number) => PromiseLike<T> | T): AsyncQuery<T>;
Parameters
- accumulator
- (current: T, element: T, offset: number) => PromiseLike<T> | T
The callback used to compute each result.
Returns
scan(accumulator, seed)
Creates a subquery containing the cumulative results of applying the provided callback to each element.
Declaration
scan<U>(accumulator: (current: U, element: T, offset: number) => PromiseLike<U> | U, seed: U): AsyncQuery<U>;
Type Parameters
- U
Parameters
- accumulator
- (current: U, element: T, offset: number) => PromiseLike<U> | U
The callback used to compute each result.
- seed
- U
An optional seed value. Subquery
Returns
scanRight(accumulator)
Creates a subquery containing the cumulative results of applying the provided callback to each element in reverse.
Declaration
scanRight(accumulator: (current: T, element: T, offset: number) => PromiseLike<T> | T): AsyncQuery<T>;
Parameters
- accumulator
- (current: T, element: T, offset: number) => PromiseLike<T> | T
The callback used to compute each result.
Returns
scanRight(accumulator, seed)
Creates a subquery containing the cumulative results of applying the provided callback to each element in reverse.
Declaration
scanRight<U>(accumulator: (current: U, element: T, offset: number) => PromiseLike<U> | U, seed?: U): AsyncQuery<U>;
Type Parameters
- U
Parameters
- accumulator
- (current: U, element: T, offset: number) => PromiseLike<U> | U
The callback used to compute each result.
- seed
- U
An optional seed value. Subquery
Returns
select(selector)
Creates a subquery by applying a callback to each element.
NOTE: This is an alias for map
.
Declaration
select<U>(selector: (element: T, offset: number) => PromiseLike<U> | U): AsyncQuery<U>;
Type Parameters
- U
Parameters
Returns
selectMany(projection)
Creates a subquery that iterates the results of applying a callback to each element.
NOTE: This is an alias for flatMap
.
Declaration
selectMany<U>(projection: (element: T) => AsyncIterable<U> | Iterable<PromiseLike<U> | U>): AsyncQuery<U>;
Type Parameters
- U
Parameters
- projection
- (element: T) => AsyncIterable<U> | Iterable<PromiseLike<U> | U>
A callback used to map each element into an iterable.
Returns
selectMany(projection, resultSelector)
Creates a subquery that iterates the results of applying a callback to each element.
NOTE: This is an alias for flatMap
.
Declaration
selectMany<U, R>(projection: (element: T) => AsyncIterable<U> | Iterable<PromiseLike<U> | U>, resultSelector: (element: T, innerElement: U) => PromiseLike<R> | R): AsyncQuery<R>;
Type Parameters
- U
- R
Parameters
- projection
- (element: T) => AsyncIterable<U> | Iterable<PromiseLike<U> | U>
A callback used to map each element into an iterable.
- resultSelector
- (element: T, innerElement: U) => PromiseLike<R> | R
An optional callback used to map the outer and projected inner elements.
Returns
single(predicate)
Gets the only element in the AsyncQuery
, or returns undefined
.
Declaration
single<U extends T>(predicate: (element: T) => element is U): Promise<U | undefined>;
Type Parameters
- U
Parameters
- predicate
- (element: T) => element is U
An optional callback used to match each element. Scalar
Returns
single(predicate)
Gets the only element in the AsyncQuery
, or returns undefined.
Declaration
single(predicate?: (element: T) => PromiseLike<boolean> | boolean): Promise<T | undefined>;
Parameters
- predicate
- (element: T) => PromiseLike<boolean> | boolean
An optional callback used to match each element. Scalar
Returns
skip(count)
Creates a subquery containing all elements except the first elements up to the supplied count.
NOTE: This is an alias for drop
.
Declaration
skip(count: number): AsyncUnorderedQueryFlow<this, T>;
Parameters
Returns
skipRight(count)
Creates a subquery containing all elements except the last elements up to the supplied count.
NOTE: This is an alias for dropRight
.
Declaration
skipRight(count: number): AsyncUnorderedQueryFlow<this, T>;
Parameters
Returns
skipUntil(predicate)
Creates a subquery containing all elements except the first elements that don't match the supplied predicate.
NOTE: This is an alias for dropUntil
.
Declaration
skipUntil(predicate: (element: T) => PromiseLike<boolean> | boolean): AsyncUnorderedQueryFlow<this, T>;
Parameters
Returns
skipWhile(predicate)
Creates a subquery containing all elements except the first elements that match the supplied predicate.
NOTE: This is an alias for dropWhile
.
Declaration
skipWhile(predicate: (element: T) => PromiseLike<boolean> | boolean): AsyncUnorderedQueryFlow<this, T>;
Parameters
Returns
some(predicate)
Computes a scalar value indicating whether the AsyncQuery
contains any elements,
optionally filtering the elements using the supplied callback.
Declaration
some(predicate?: (element: T) => PromiseLike<boolean> | boolean): Promise<boolean>;
Parameters
- predicate
- (element: T) => PromiseLike<boolean> | boolean
An optional callback used to match each element. Scalar
Returns
span(predicate)
Creates a tuple whose first element is a subquery containing the first span of elements that match the supplied predicate, and whose second element is a subquery containing the remaining elements.
The first subquery is eagerly evaluated, while the second subquery is lazily evaluated.
Declaration
span<U extends T>(predicate: (element: T, offset: number) => element is U): Promise<[UnorderedQueryFlow<this, U>, AsyncUnorderedQueryFlow<this, T>]>;
Type Parameters
- U
Parameters
- predicate
- (element: T, offset: number) => element is U
The predicate used to match elements. Scalar
Returns
span(predicate)
Creates a tuple whose first element is a subquery containing the first span of elements that match the supplied predicate, and whose second element is a subquery containing the remaining elements.
The first subquery is eagerly evaluated, while the second subquery is lazily evaluated.
Declaration
span(predicate: (element: T, offset: number) => PromiseLike<boolean> | boolean): Promise<[UnorderedQueryFlow<this, T>, AsyncUnorderedQueryFlow<this, T>]>;
Parameters
- predicate
- (element: T, offset: number) => PromiseLike<boolean> | boolean
The predicate used to match elements. Scalar
Returns
spanMap(keySelector, keyEqualer)
Creates a subquery whose elements are the contiguous ranges of elements that share the same key.
Declaration
spanMap<K>(keySelector: (element: T) => K, keyEqualer?: Equaler<K>): AsyncGroupedQueryFlow<this, K, T>;
Type Parameters
- K
Parameters
- keySelector
- (element: T) => K
A callback used to select the key for an element.
- keyEqualer
- Equaler<K>
Returns
spanMap(keySelector, elementSelector, keyEqualer)
Creates a subquery whose values are computed from each element of the contiguous ranges of elements that share the same key.
Declaration
spanMap<K, V>(keySelector: (element: T) => K, elementSelector: (element: T) => PromiseLike<V> | V, keyEqualer?: Equaler<K>): AsyncGroupedQueryFlow<this, K, V>;
Type Parameters
- K
- V
Parameters
- keySelector
- (element: T) => K
A callback used to select the key for an element.
- elementSelector
- (element: T) => PromiseLike<V> | V
A callback used to select a value for an element.
- keyEqualer
- Equaler<K>
Returns
spanMap(keySelector, elementSelector, spanSelector, keyEqualer)
Creates a subquery whose values are computed from the contiguous ranges of elements that share the same key.
Declaration
spanMap<K, V, R>(keySelector: (element: T) => K, elementSelector: (element: T) => PromiseLike<V> | V, spanSelector: (key: K, elements: Query<V>) => PromiseLike<R> | R, keyEqualer?: Equaler<K>): AsyncQuery<R>;
Type Parameters
- K
- V
- R
Parameters
- keySelector
- (element: T) => K
A callback used to select the key for an element.
- elementSelector
- (element: T) => PromiseLike<V> | V
A callback used to select a value for an element.
- spanSelector
- (key: K, elements: Query<V>) => PromiseLike<R> | R
A callback used to select a result from a contiguous range.
- keyEqualer
- Equaler<K>
Returns
spanMap(keySelector, elementSelector, spanSelector, keyEqualer)
Creates a subquery whose values are computed from the contiguous ranges of elements that share the same key.
Declaration
spanMap<K, R>(keySelector: (element: T) => K, elementSelector: undefined, spanSelector: (key: K, elements: Query<T>) => PromiseLike<R> | R, keyEqualer?: Equaler<K>): AsyncQuery<R>;
Type Parameters
- K
- R
Parameters
- keySelector
- (element: T) => K
A callback used to select the key for an element.
- spanSelector
- (key: K, elements: Query<T>) => PromiseLike<R> | R
A callback used to select a result from a contiguous range.
- keyEqualer
- Equaler<K>
Returns
spanUntil(predicate)
Creates a tuple whose first element is a subquery containing the first span of elements that do not match the supplied predicate, and whose second element is a subquery containing the remaining elements.
The first subquery is eagerly evaluated, while the second subquery is lazily evaluated.
Declaration
spanUntil(predicate: (element: T, offset: number) => PromiseLike<boolean> | boolean): Promise<[UnorderedQueryFlow<this, T>, AsyncUnorderedQueryFlow<this, T>]>;
Parameters
- predicate
- (element: T, offset: number) => PromiseLike<boolean> | boolean
The predicate used to match elements. Scalar
Returns
startsWith(right, equaler)
Computes a scalar value indicating whether the elements of this AsyncQuery
start
with the same sequence of elements in another AsyncIterable
or Iterable
.
Declaration
startsWith(right: AsyncIterable<T> | Iterable<PromiseLike<T> | T>, equaler?: EqualityComparison<T> | Equaler<T>): Promise<boolean>;
Parameters
- equaler
- EqualityComparison<T> | Equaler<T>
A callback used to compare the equality of two elements. Scalar
Returns
startsWith(right, equaler)
Computes a scalar value indicating whether the elements of this AsyncQuery
start
with the same sequence of elements in another AsyncIterable
or Iterable
.
Declaration
startsWith<U>(right: AsyncIterable<U> | Iterable<PromiseLike<U> | U>, equaler: (left: T, right: U) => boolean): Promise<boolean>;
Type Parameters
- U
Parameters
- equaler
- (left: T, right: U) => boolean
A callback used to compare the equality of two elements. Scalar
Returns
sum()
Computes the sum for a series of numbers.
Scalar
Declaration
sum(): Promise<T extends number ? number : never>;
Returns
sum(elementSelector)
Computes the sum for a series of numbers.
Scalar
Declaration
sum(elementSelector: (element: T) => PromiseLike<number> | number): Promise<number>;
Parameters
- elementSelector
- (element: T) => PromiseLike<number> | number
Returns
symmetricDifference(right, equaler)
Creates a subquery for the symmetric difference between this and another AsyncIterable
or Iterable
.
Declaration
symmetricDifference<R extends AsyncIterable<T> | Iterable<PromiseLike<T> | T>>(right: R, equaler?: Equaler<T>): AsyncMergeQueryFlow<this, R, T>;
Type Parameters
- R
Parameters
- right
- R
An AsyncIterable
or Iterable
object.
Returns
symmetricDifference(right, equaler)
Creates a subquery for the symmetric difference between this and another AsyncIterable
or Iterable
.
Declaration
symmetricDifference(right: AsyncIterable<T> | Iterable<PromiseLike<T> | T>, equaler?: Equaler<T>): AsyncQuery<T>;
Parameters
Returns
symmetricDifferenceBy(right, keySelector, keyEqualer)
Creates a subquery for the symmetric difference between this and another AsyncIterable
or Iterable
, where set identity is determined by the selected key.
Declaration
symmetricDifferenceBy<K, R extends AsyncIterable<T> | Iterable<PromiseLike<T> | T>>(right: R, keySelector: (element: T) => K, keyEqualer?: Equaler<K>): AsyncMergeQueryFlow<this, R, T>;
Type Parameters
- K
- R
Parameters
- right
- R
An AsyncIterable
or Iterable
object.
- keySelector
- (element: T) => K
A callback used to select the key for each element.
Returns
symmetricDifferenceBy(right, keySelector, keyEqualer)
Creates a subquery for the symmetric difference between this and another AsyncIterable
or Iterable
, where set identity is determined by the selected key.
Declaration
symmetricDifferenceBy<K>(right: AsyncIterable<T> | Iterable<PromiseLike<T> | T>, keySelector: (element: T) => K, keyEqualer?: Equaler<K>): AsyncQuery<T>;
Type Parameters
- K
Parameters
- keySelector
- (element: T) => K
A callback used to select the key for each element.
Returns
take(count)
Creates a subquery containing the first elements up to the supplied count.
Declaration
take(count: number): AsyncUnorderedQueryFlow<this, T>;
Parameters
Returns
takeRight(count)
Creates a subquery containing the last elements up to the supplied count.
Declaration
takeRight(count: number): AsyncUnorderedQueryFlow<this, T>;
Parameters
Returns
takeUntil(predicate)
Creates a subquery containing the first elements that do not match the supplied predicate.
Declaration
takeUntil(predicate: (element: T) => PromiseLike<boolean> | boolean): AsyncUnorderedQueryFlow<this, T>;
Parameters
Returns
takeWhile(predicate)
Creates a subquery containing the first elements that match the supplied predicate.
Declaration
takeWhile<U extends T>(predicate: (element: T) => element is U): AsyncUnorderedQueryFlow<this, U>;
Type Parameters
- U
Parameters
- predicate
- (element: T) => element is U
A callback used to match each element.
Returns
takeWhile(predicate)
Creates a subquery containing the first elements that match the supplied predicate.
Declaration
takeWhile(predicate: (element: T) => PromiseLike<boolean> | boolean): AsyncUnorderedQueryFlow<this, T>;
Parameters
Returns
tap(callback)
Lazily invokes a callback as each element of the AsyncQuery
is iterated.
Declaration
tap(callback: (element: T, offset: number) => PromiseLike<void> | void): AsyncUnorderedQueryFlow<this, T>;
Parameters
Returns
through(callback)
Pass the entire AsyncQuery
to the provided callback, creating a new AsyncQuery
from the result.
Declaration
through<R extends AsyncIterable<any> | Iterable<any>>(callback: (source: this) => R): AsyncQueryFlow<R, R extends AsyncIterable<infer U> ? U : R extends Iterable<infer U> ? U extends PromiseLike<infer P> ? P : U : unknown>;
Type Parameters
- R
Parameters
- callback
- (source: this) => R
A callback function.
Returns
toArray()
Creates an Array for the elements of the AsyncQuery
.
Scalar
Declaration
toArray(): Promise<T[]>;
Returns
toArray(elementSelector)
Creates an Array for the elements of the AsyncQuery
.
Declaration
toArray<V>(elementSelector: (element: T) => PromiseLike<V> | V): Promise<V[]>;
Type Parameters
- V
Parameters
- elementSelector
- (element: T) => PromiseLike<V> | V
A callback that selects a value for each element. Scalar
Returns
toHashMap(keySelector, keyEqualer)
Creates a HashMap
for the elements of the AsyncQuery
.
Declaration
toHashMap<K>(keySelector: (element: T) => K, keyEqualer?: Equaler<K>): Promise<HashMap<K, T>>;
Type Parameters
- K
Parameters
- keySelector
- (element: T) => K
A callback used to select a key for each element.
Returns
toHashMap(keySelector, elementSelector, keyEqualer)
Creates a HashMap
for the elements of the AsyncQuery
.
Declaration
toHashMap<K, V>(keySelector: (element: T) => K, elementSelector: (element: T) => PromiseLike<V> | V, keyEqualer?: Equaler<K>): Promise<HashMap<K, V>>;
Type Parameters
- K
- V
Parameters
- keySelector
- (element: T) => K
A callback used to select a key for each element.
- elementSelector
- (element: T) => PromiseLike<V> | V
A callback that selects a value for each element.
Returns
toHashSet(equaler)
Creates a HashSet
for the elements of the AsyncQuery
.
Declaration
toHashSet(equaler?: Equaler<T>): Promise<HashSet<T>>;
Parameters
Returns
toHashSet(elementSelector, equaler)
Creates a HashSet
for the elements of the AsyncQuery
.
Declaration
toHashSet<V>(elementSelector: (element: T) => PromiseLike<V> | V, equaler: Equaler<V>): Promise<HashSet<V>>;
Type Parameters
- V
Parameters
- elementSelector
- (element: T) => PromiseLike<V> | V
A callback that selects a value for each element.
Returns
toHierarchy(provider)
Creates an AsyncHierarchyQuery
using the provided HierarchyProvider
.
Declaration
toHierarchy<TNode extends (T extends TNode ? unknown : never)>(provider: HierarchyProvider<TNode>): AsyncHierarchyQueryFlow<this, TNode, T>;
Type Parameters
- TNode
Parameters
Returns
toLookup(keySelector, keyEqualer)
Creates a Lookup
for the elements of the AsyncQuery
.
Declaration
toLookup<K>(keySelector: (element: T) => K, keyEqualer?: Equaler<K>): Promise<Lookup<K, T>>;
Type Parameters
- K
Parameters
- keySelector
- (element: T) => K
A callback used to select a key for each element.
Returns
toLookup(keySelector, elementSelector, keyEqualer)
Creates a Lookup
for the elements of the AsyncQuery
.
Declaration
toLookup<K, V>(keySelector: (element: T) => K, elementSelector: (element: T) => PromiseLike<V> | V, keyEqualer?: Equaler<K>): Promise<Lookup<K, V>>;
Type Parameters
- K
- V
Parameters
- keySelector
- (element: T) => K
A callback used to select a key for each element.
- elementSelector
- (element: T) => PromiseLike<V> | V
A callback that selects a value for each element.
Returns
toMap(keySelector)
Creates a Map
for the elements of the AsyncQuery
.
Declaration
toMap<K>(keySelector: (element: T) => K): Promise<Map<K, T>>;
Type Parameters
- K
Parameters
- keySelector
- (element: T) => K
A callback used to select a key for each element. Scalar
Returns
toMap(keySelector, elementSelector)
Creates a Map
for the elements of the AsyncQuery
.
Declaration
toMap<K, V>(keySelector: (element: T) => K, elementSelector: (element: T) => PromiseLike<V> | V): Promise<Map<K, V>>;
Type Parameters
- K
- V
Parameters
- keySelector
- (element: T) => K
A callback used to select a key for each element.
- elementSelector
- (element: T) => PromiseLike<V> | V
A callback that selects a value for each element. Scalar
Returns
toObject(prototype, keySelector)
Creates an Object for the elements of the AsyncQuery
. Properties are added via Object.defineProperty
.
// As a regular object
const obj = from(`"`, 1], ["y", 2]]).toObject(undefined, a => a[0]);
obj.x; // ["x", 1]
obj.y; // ["y", 2]
typeof obj.toString; // function
// with a custom prototype
const baseObject = { toString() { return `${this.x}:${this.y}` } };
const obj = from(`"`, 1], ["y", 2]]).toObject(baseObject, a => a[0]);
obj.x; // ["x", 1]
obj.y; // ["y", 2]
typeof obj.toString; // function
obj.toString(); // "x",1:"y",2
// with a null prototype
const obj = from(`"`, 1], ["y", 2]]).toObject(null, a => a[0]);
obj.x; // ["x", 1]
obj.y; // ["y", 2]
typeof obj.toString; // undefined
Declaration
toObject<TProto extends object, K extends PropertyKey>(prototype: TProto, keySelector: (element: T) => K): Promise<TProto & Record<K, T>>;
Type Parameters
- TProto
- K
Parameters
- prototype
- TProto
The prototype for the object. If prototype
is null
, an object with a null
prototype is created. If prototype
is undefined
, the default Object.prototype
is used.
- keySelector
- (element: T) => K
A callback used to select a key for each element. Scalar
Returns
toObject(prototype, keySelector)
Creates an Object for the elements of the AsyncQuery
. Properties are added via Object.defineProperty
.
// As a regular object
const obj = from(`"`, 1], ["y", 2]]).toObject(undefined, a => a[0]);
obj.x; // ["x", 1]
obj.y; // ["y", 2]
typeof obj.toString; // function
// with a custom prototype
const baseObject = { toString() { return `${this.x}:${this.y}` } };
const obj = from(`"`, 1], ["y", 2]]).toObject(baseObject, a => a[0]);
obj.x; // ["x", 1]
obj.y; // ["y", 2]
typeof obj.toString; // function
obj.toString(); // "x",1:"y",2
// with a null prototype
const obj = from(`"`, 1], ["y", 2]]).toObject(null, a => a[0]);
obj.x; // ["x", 1]
obj.y; // ["y", 2]
typeof obj.toString; // undefined
Declaration
toObject<TProto extends object>(prototype: TProto, keySelector: (element: T) => PropertyKey): Promise<TProto & Record<PropertyKey, T>>;
Type Parameters
- TProto
Parameters
- prototype
- TProto
The prototype for the object. If prototype
is null
, an object with a null
prototype is created. If prototype
is undefined
, the default Object.prototype
is used.
- keySelector
- (element: T) => PropertyKey
A callback used to select a key for each element. Scalar
Returns
toObject(prototype, keySelector)
Creates an Object for the elements of the AsyncQuery
. Properties are added via Object.defineProperty
.
// As a regular object
const obj = from(`"`, 1], ["y", 2]]).toObject(undefined, a => a[0]);
obj.x; // ["x", 1]
obj.y; // ["y", 2]
typeof obj.toString; // function
// with a custom prototype
const baseObject = { toString() { return `${this.x}:${this.y}` } };
const obj = from(`"`, 1], ["y", 2]]).toObject(baseObject, a => a[0]);
obj.x; // ["x", 1]
obj.y; // ["y", 2]
typeof obj.toString; // function
obj.toString(); // "x",1:"y",2
// with a null prototype
const obj = from(`"`, 1], ["y", 2]]).toObject(null, a => a[0]);
obj.x; // ["x", 1]
obj.y; // ["y", 2]
typeof obj.toString; // undefined
Declaration
toObject<K extends PropertyKey>(prototype: object | null | undefined, keySelector: (element: T) => K): Promise<Record<PropertyKey, T>>;
Type Parameters
- K
Parameters
- prototype
- object | null | undefined
The prototype for the object. If prototype
is null
, an object with a null
prototype is created. If prototype
is undefined
, the default Object.prototype
is used.
- keySelector
- (element: T) => K
A callback used to select a key for each element. Scalar
Returns
toObject(prototype, keySelector)
Creates an Object for the elements of the AsyncQuery
. Properties are added via Object.defineProperty
.
// As a regular object
const obj = from(`"`, 1], ["y", 2]]).toObject(undefined, a => a[0]);
obj.x; // ["x", 1]
obj.y; // ["y", 2]
typeof obj.toString; // function
// with a custom prototype
const baseObject = { toString() { return `${this.x}:${this.y}` } };
const obj = from(`"`, 1], ["y", 2]]).toObject(baseObject, a => a[0]);
obj.x; // ["x", 1]
obj.y; // ["y", 2]
typeof obj.toString; // function
obj.toString(); // "x",1:"y",2
// with a null prototype
const obj = from(`"`, 1], ["y", 2]]).toObject(null, a => a[0]);
obj.x; // ["x", 1]
obj.y; // ["y", 2]
typeof obj.toString; // undefined
Declaration
toObject(prototype: object | null | undefined, keySelector: (element: T) => PropertyKey): Promise<object>;
Parameters
- prototype
- object | null | undefined
The prototype for the object. If prototype
is null
, an object with a null
prototype is created. If prototype
is undefined
, the default Object.prototype
is used.
- keySelector
- (element: T) => PropertyKey
A callback used to select a key for each element. Scalar
Returns
toObject(prototype, keySelector, elementSelector, descriptorSelector)
Creates an Object for the elements the AsyncQuery
. Properties are added via Object.defineProperty
.
// As a regular object
const obj = from(`"`, 1], ["y", 2]]).toObject(undefined, a => a[0], a => a[1]);
obj.x; // 1
obj.y; // 2
typeof obj.toString; // function
// with a custom prototype
const baseObject = { toString() { return `${this.x}:${this.y}` } };
const obj = from(`"`, 1], ["y", 2]]).toObject(baseObject, a => a[0], a => a[1]);
obj.x; // 1
obj.y; // 2
typeof obj.toString; // function
obj.toString(); // 1:2
// with a null prototype
const obj = from(`"`, 1], ["y", 2]]).toObject(null, a => a[0], a => a[1]);
obj.x; // 1
obj.y; // 2
typeof obj.toString; // undefined
Declaration
toObject<TProto extends object, K extends PropertyKey, V>(prototype: TProto, keySelector: (element: T) => K, elementSelector: (element: T) => PromiseLike<V> | V, descriptorSelector?: (key: K, element: V) => TypedPropertyDescriptor<V>): Promise<TProto & Record<K, V>>;
Type Parameters
- TProto
- K
- V
Parameters
- prototype
- TProto
The prototype for the object. If prototype
is null
, an object with a null
prototype is created. If prototype
is undefined
, the default Object.prototype
is used.
- keySelector
- (element: T) => K
A callback used to select a key for each element.
- elementSelector
- (element: T) => PromiseLike<V> | V
A callback that selects a value for each element.
- descriptorSelector
- (key: K, element: V) => TypedPropertyDescriptor<V>
A callback that defines the PropertyDescriptor
for each property.
Scalar
Returns
toObject(prototype, keySelector, elementSelector, descriptorSelector)
Creates an Object for the elements the AsyncQuery
. Properties are added via Object.defineProperty
.
// As a regular object
const obj = from(`"`, 1], ["y", 2]]).toObject(undefined, a => a[0], a => a[1]);
obj.x; // 1
obj.y; // 2
typeof obj.toString; // function
// with a custom prototype
const baseObject = { toString() { return `${this.x}:${this.y}` } };
const obj = from(`"`, 1], ["y", 2]]).toObject(baseObject, a => a[0], a => a[1]);
obj.x; // 1
obj.y; // 2
typeof obj.toString; // function
obj.toString(); // 1:2
// with a null prototype
const obj = from(`"`, 1], ["y", 2]]).toObject(null, a => a[0], a => a[1]);
obj.x; // 1
obj.y; // 2
typeof obj.toString; // undefined
Declaration
toObject<TProto extends object, V>(prototype: TProto, keySelector: (element: T) => PropertyKey, elementSelector: (element: T) => PromiseLike<V> | V, descriptorSelector?: (key: PropertyKey, element: V) => TypedPropertyDescriptor<V>): Promise<TProto & Record<PropertyKey, V>>;
Type Parameters
- TProto
- V
Parameters
- prototype
- TProto
The prototype for the object. If prototype
is null
, an object with a null
prototype is created. If prototype
is undefined
, the default Object.prototype
is used.
- keySelector
- (element: T) => PropertyKey
A callback used to select a key for each element.
- elementSelector
- (element: T) => PromiseLike<V> | V
A callback that selects a value for each element.
- descriptorSelector
- (key: PropertyKey, element: V) => TypedPropertyDescriptor<V>
A callback that defines the PropertyDescriptor
for each property.
Scalar
Returns
toObject(prototype, keySelector, elementSelector, descriptorSelector)
Creates an Object for the elements the AsyncQuery
. Properties are added via Object.defineProperty
.
// As a regular object
const obj = from(`"`, 1], ["y", 2]]).toObject(undefined, a => a[0], a => a[1]);
obj.x; // 1
obj.y; // 2
typeof obj.toString; // function
// with a custom prototype
const baseObject = { toString() { return `${this.x}:${this.y}` } };
const obj = from(`"`, 1], ["y", 2]]).toObject(baseObject, a => a[0], a => a[1]);
obj.x; // 1
obj.y; // 2
typeof obj.toString; // function
obj.toString(); // 1:2
// with a null prototype
const obj = from(`"`, 1], ["y", 2]]).toObject(null, a => a[0], a => a[1]);
obj.x; // 1
obj.y; // 2
typeof obj.toString; // undefined
Declaration
toObject<K extends PropertyKey, V>(prototype: object | null | undefined, keySelector: (element: T) => K, elementSelector: (element: T) => PromiseLike<V> | V, descriptorSelector?: (key: K, element: V) => TypedPropertyDescriptor<V>): Promise<Record<K, V>>;
Type Parameters
- K
- V
Parameters
- prototype
- object | null | undefined
The prototype for the object. If prototype
is null
, an object with a null
prototype is created. If prototype
is undefined
, the default Object.prototype
is used.
- keySelector
- (element: T) => K
A callback used to select a key for each element.
- elementSelector
- (element: T) => PromiseLike<V> | V
A callback that selects a value for each element.
- descriptorSelector
- (key: K, element: V) => TypedPropertyDescriptor<V>
A callback that defines the PropertyDescriptor
for each property.
Scalar
Returns
toObject(prototype, keySelector, elementSelector, descriptorSelector)
Creates an Object for the elements the AsyncQuery
. Properties are added via Object.defineProperty
.
// As a regular object
const obj = from(`"`, 1], ["y", 2]]).toObject(undefined, a => a[0], a => a[1]);
obj.x; // 1
obj.y; // 2
typeof obj.toString; // function
// with a custom prototype
const baseObject = { toString() { return `${this.x}:${this.y}` } };
const obj = from(`"`, 1], ["y", 2]]).toObject(baseObject, a => a[0], a => a[1]);
obj.x; // 1
obj.y; // 2
typeof obj.toString; // function
obj.toString(); // 1:2
// with a null prototype
const obj = from(`"`, 1], ["y", 2]]).toObject(null, a => a[0], a => a[1]);
obj.x; // 1
obj.y; // 2
typeof obj.toString; // undefined
Declaration
toObject<V>(prototype: object | null | undefined, keySelector: (element: T) => PropertyKey, elementSelector: (element: T) => PromiseLike<V> | V, descriptorSelector?: (key: PropertyKey, element: V) => TypedPropertyDescriptor<V>): Promise<Record<PropertyKey, V>>;
Type Parameters
- V
Parameters
- prototype
- object | null | undefined
The prototype for the object. If prototype
is null
, an object with a null
prototype is created. If prototype
is undefined
, the default Object.prototype
is used.
- keySelector
- (element: T) => PropertyKey
A callback used to select a key for each element.
- elementSelector
- (element: T) => PromiseLike<V> | V
A callback that selects a value for each element.
- descriptorSelector
- (key: PropertyKey, element: V) => TypedPropertyDescriptor<V>
A callback that defines the PropertyDescriptor
for each property.
Scalar
Returns
toObject(prototype, keySelector, elementSelector, descriptorSelector)
Creates an Object for the elements the AsyncQuery
. Properties are added via Object.defineProperty
.
// As a regular object
const obj = from(`"`, 1], ["y", 2]]).toObject(undefined, a => a[0], a => a[1]);
obj.x; // 1
obj.y; // 2
typeof obj.toString; // function
// with a custom prototype
const baseObject = { toString() { return `${this.x}:${this.y}` } };
const obj = from(`"`, 1], ["y", 2]]).toObject(baseObject, a => a[0], a => a[1]);
obj.x; // 1
obj.y; // 2
typeof obj.toString; // function
obj.toString(); // 1:2
// with a null prototype
const obj = from(`"`, 1], ["y", 2]]).toObject(null, a => a[0], a => a[1]);
obj.x; // 1
obj.y; // 2
typeof obj.toString; // undefined
Declaration
toObject<V>(prototype: object | null | undefined, keySelector: (element: T) => PropertyKey, elementSelector: (element: T) => PromiseLike<V> | V, descriptorSelector?: (key: PropertyKey, element: V) => PropertyDescriptor): Promise<object>;
Type Parameters
- V
Parameters
- prototype
- object | null | undefined
The prototype for the object. If prototype
is null
, an object with a null
prototype is created. If prototype
is undefined
, the default Object.prototype
is used.
- keySelector
- (element: T) => PropertyKey
A callback used to select a key for each element.
- elementSelector
- (element: T) => PromiseLike<V> | V
A callback that selects a value for each element.
- descriptorSelector
- (key: PropertyKey, element: V) => PropertyDescriptor
A callback that defines the PropertyDescriptor
for each property.
Scalar
Returns
toSet()
Creates a Set
for the elements of the AsyncQuery
.
Scalar
Declaration
toSet(): Promise<Set<T>>;
Returns
toSet(elementSelector)
Creates a Set
for the elements of the AsyncQuery
.
Declaration
toSet<V>(elementSelector: (element: T) => PromiseLike<V> | V): Promise<Set<V>>;
Type Parameters
- V
Parameters
- elementSelector
- (element: T) => PromiseLike<V> | V
A callback that selects a value for each element. Scalar
Returns
union(right, equaler)
Creates a subquery for the set union of this AsyncQuery
and another AsyncIterable
or Iterable
.
Declaration
union<R extends AsyncIterable<T> | Iterable<PromiseLike<T> | T>>(right: R, equaler?: Equaler<T>): AsyncMergeQueryFlow<this, R, T>;
Type Parameters
- R
Parameters
- right
- R
An AsyncIterable
or Iterable
object.
Returns
union(right, equaler)
Creates a subquery for the set union of this AsyncQuery
and another AsyncIterable
or Iterable
.
Declaration
union(right: AsyncIterable<T> | Iterable<PromiseLike<T> | T>, equaler?: Equaler<T>): AsyncQuery<T>;
Parameters
Returns
unionBy(right, keySelector, keyEqualer)
Creates a subquery for the set union of this AsyncQuery
and another AsyncIterable
or Iterable
, where set identity is determined by the selected key.
Declaration
unionBy<K, R extends AsyncIterable<T> | Iterable<PromiseLike<T> | T>>(right: R, keySelector: (element: T) => K, keyEqualer?: Equaler<K>): AsyncMergeQueryFlow<this, R, T>;
Type Parameters
- K
- R
Parameters
- right
- R
An AsyncIterable
or Iterable
object.
- keySelector
- (element: T) => K
A callback used to select the key for each element.
Returns
unionBy(right, keySelector, keyEqualer)
Creates a subquery for the set union of this AsyncQuery
and another AsyncIterable
or Iterable
, where set identity is determined by the selected key.
Declaration
unionBy<K>(right: AsyncIterable<T> | Iterable<PromiseLike<T> | T>, keySelector: (element: T) => K, keyEqualer?: Equaler<K>): AsyncQuery<T>;
Type Parameters
- K
Parameters
- keySelector
- (element: T) => K
A callback used to select the key for each element.
Returns
unzip()
Unzips a sequence of tuples into a tuple of sequences.
Declaration
unzip(): Promise<T extends readonly unknown[] | [] ? {
-readonly [I in keyof T]: T[I][];
} : unknown[]>;
Returns
unzip(partSelector)
Unzips a sequence of tuples into a tuple of sequences.
Declaration
unzip<U extends readonly unknown[] | []>(partSelector: (value: T) => U): Promise<{
-readonly [I in keyof U]: U[I][];
}>;
Type Parameters
- U
Parameters
- partSelector
- (value: T) => U
A callback that converts a result into a tuple. Scalar
Returns
where(predicate)
Creates a subquery whose elements match the supplied predicate.
NOTE: This is an alias for filter
.
Declaration
where<U extends T>(predicate: (element: T, offset: number) => element is U): AsyncUnorderedQueryFlow<this, U>;
Type Parameters
- U
Parameters
- predicate
- (element: T, offset: number) => element is U
A callback used to match each element.
Returns
where(predicate)
Creates a subquery whose elements match the supplied predicate.
NOTE: This is an alias for filter
.
Declaration
where(predicate: (element: T, offset: number) => PromiseLike<boolean> | boolean): AsyncUnorderedQueryFlow<this, T>;
Parameters
- predicate
- (element: T, offset: number) => PromiseLike<boolean> | boolean
A callback used to match each element.
Returns
whereBy(keySelector, predicate)
Creates a subquery where the selected key for each element matches the supplied predicate.
NOTE: This is an alias for filterBy
.
Declaration
whereBy<K>(keySelector: (element: T) => K, predicate: (key: K, offset: number) => PromiseLike<boolean> | boolean): AsyncUnorderedQueryFlow<this, T>;
Type Parameters
- K
Parameters
- keySelector
- (element: T) => K
A callback used to select the key for each element.
- predicate
- (key: K, offset: number) => PromiseLike<boolean> | boolean
A callback used to match each key.
Returns
whereDefined()
Creates a subquery whose elements are neither null
nor undefined
.
NOTE: This is an alias for filterDefined
.
Subquery
Declaration
whereDefined(): AsyncUnorderedQueryFlow<this, NonNullable<T>>;
Returns
whereDefinedBy(keySelector)
Creates a subquery where the selected key for each element is neither null
nor undefined
.
NOTE: This is an alias for filterDefinedBy
.
Declaration
whereDefinedBy<K>(keySelector: (element: T) => K): AsyncUnorderedQueryFlow<this, T>;
Type Parameters
- K
Parameters
- keySelector
- (element: T) => K
A callback used to select the key for each element.
Returns
whereNot(predicate)
Creates a subquery whose elements do not match the supplied predicate.
NOTE: This is an alias for filterNot
.
Declaration
whereNot<U extends T>(predicate: (element: T, offset: number) => element is U): AsyncUnorderedQueryFlow<this, U>;
Type Parameters
- U
Parameters
- predicate
- (element: T, offset: number) => element is U
A callback used to match each element.
Returns
whereNot(predicate)
Creates a subquery whose elements do not match the supplied predicate.
NOTE: This is an alias for filterNot
.
Declaration
whereNot(predicate: (element: T, offset: number) => PromiseLike<boolean> | boolean): AsyncUnorderedQueryFlow<this, T>;
Parameters
- predicate
- (element: T, offset: number) => PromiseLike<boolean> | boolean
A callback used to match each element.
Returns
whereNotBy(keySelector, predicate)
Creates a subquery where the selected key for each element does not match the supplied predicate.
NOTE: This is an alias for filterNotBy
.
Declaration
whereNotBy<K>(keySelector: (element: T) => K, predicate: (key: K, offset: number) => PromiseLike<boolean> | boolean): AsyncUnorderedQueryFlow<this, T>;
Type Parameters
- K
Parameters
- keySelector
- (element: T) => K
A callback used to select the key for each element.
- predicate
- (key: K, offset: number) => PromiseLike<boolean> | boolean
A callback used to match each key.
Returns
whereNotDefinedBy(keySelector)
Creates a subquery where the selected key for each element is either null
or undefined
.
NOTE: This is an alias for filterNotDefinedBy
.
Declaration
whereNotDefinedBy<K>(keySelector: (element: T) => K): AsyncUnorderedQueryFlow<this, T>;
Type Parameters
- K
Parameters
- keySelector
- (element: T) => K
A callback used to select the key for each element.
Returns
zip(right)
Creates a subquery that combines this AsyncQuery
with another AsyncIterable
or Iterable
by combining elements
in tuples.
Declaration
zip<U>(right: AsyncIterable<U> | Iterable<PromiseLike<U> | U>): AsyncQuery<[T, U]>;
Type Parameters
- U
Parameters
Returns
zip(right, selector)
Creates a subquery that combines this AsyncQuery
with another AsyncIterable
or Iterable
by combining elements
using the supplied callback.
Declaration
zip<U, R>(right: AsyncIterable<U> | Iterable<PromiseLike<U> | U>, selector: (left: T, right: U) => PromiseLike<R> | R): AsyncQuery<R>;
Type Parameters
- U
- R
Parameters
Returns