@esfx/async-iter-query Package
An iteration and query API for ECMAscript async-iterables.
Installation
npm i @esfx/async-iter-query
Usage
import { AsyncQuery } from "@esfx/async-iter-query";
let q = AsyncQuery
.from(books)
.filter(book => book.author === "Alice")
.groupBy(book => book.releaseYear);
Classes
AsyncHierarchyQuery
Represents a sequence of hierarchically organized values.
AsyncOrderedHierarchyQuery
Represents an ordered sequence of hierarchically organized values.
AsyncOrderedQuery
Represents an ordered sequence of elements.
AsyncQuery
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.
Functions
fromAsync(source)
Creates a AsyncQuery
from an AsyncIterable
or Iterable
source.
Declaration
export declare function 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
export declare function 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
export declare function 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
export declare function 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
export declare function fromAsync<T>(source: AsyncOrderedIterable<T> | OrderedIterable<T>): AsyncOrderedQuery<T>;
Type Parameters
- T
Parameters
- source
- AsyncOrderedIterable<T> | OrderedIterable<T>
Returns
fromAsync(source)
Declaration
export declare function 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
export declare function fromAsync<T>(source: AsyncIterable<T> | Iterable<PromiseLike<T> | T>): AsyncQuery<T>;
Type Parameters
- T
Parameters
- source
- AsyncIterable<T> | Iterable<PromiseLike<T> | T>
Returns
Type Aliases
AsyncGroupedQueryFlow
Declaration
export declare type AsyncGroupedQueryFlow<S, K, T> = S extends Hierarchical<infer TNode> ? AsyncQuery<HierarchyGrouping<K, TNode, TNode & T>> : AsyncQuery<Grouping<K, T>>;
Type Parameters
- S
- K
- T
AsyncHierarchyQueryFlow
Declaration
export declare type AsyncHierarchyQueryFlow<S, TNode extends (T extends TNode ? unknown : never), T> = S extends AsyncOrderedIterable<any> | OrderedIterable<any> ? AsyncOrderedHierarchyQuery<TNode, TNode & T> : AsyncHierarchyQuery<TNode, TNode & T>;
Type Parameters
- S
- TNode
- T
AsyncMergeQueryFlow
Declaration
export declare type AsyncMergeQueryFlow<L, R, T> = L extends Hierarchical<infer LTNode> ? R extends Hierarchical<infer RTNode> ? AsyncHierarchyQuery<LTNode | RTNode, LTNode & T | RTNode & T> : AsyncHierarchyQuery<LTNode, LTNode & T> : R extends Hierarchical<infer RTNode> ? AsyncHierarchyQuery<RTNode, RTNode & T> : AsyncQuery<T>;
Type Parameters
- L
- R
- T
AsyncOrderedQueryFlow
Declaration
export declare type AsyncOrderedQueryFlow<S, T> = S extends Hierarchical<infer TNode> ? AsyncOrderedHierarchyQuery<TNode, TNode & T> : AsyncOrderedQuery<T>;
Type Parameters
- S
- T
AsyncPagedQueryFlow
Declaration
export declare type AsyncPagedQueryFlow<S, T> = S extends Hierarchical<infer TNode> ? AsyncQuery<HierarchyPage<TNode, TNode & T>> : AsyncQuery<Page<T>>;
Type Parameters
- S
- T
AsyncQueryFlow
Declaration
export declare type AsyncQueryFlow<S, T> = S extends AsyncOrderedIterable<any> | OrderedIterable<any> ? AsyncOrderedQueryFlow<S, T> : AsyncUnorderedQueryFlow<S, T>;
Type Parameters
- S
- T
AsyncUnorderedQueryFlow
Declaration
export declare type AsyncUnorderedQueryFlow<S, T> = S extends Hierarchical<infer TNode> ? AsyncHierarchyQuery<TNode, TNode & T> : AsyncQuery<T>;
Type Parameters
- S
- T