Query Class

    Package: @esfx/iter-query

    A Query 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 Query or the Query is iterated.

    Declaration
    export declare class Query<T> implements Iterable<T> 

    Constructors

    constructor(source)

    Creates a Query from a Iterable source.

    Declaration
    constructor(source: Iterable<T>);
    Parameters
    source
    Iterable<T>

    A Iterable object.

    Methods

    _from(source)

    Declaration
    protected _from<TNode, T extends TNode>(source: OrderedHierarchyIterable<TNode, T>): OrderedHierarchyQuery<TNode, T>;
    Type Parameters
    TNode

    T

    Parameters
    source
    OrderedHierarchyIterable<TNode, T>

    Returns
    OrderedHierarchyQuery<TNode, T>

    _from(source)

    Declaration
    protected _from<TNode, T extends TNode>(source: HierarchyIterable<TNode, T>): HierarchyQuery<TNode, T>;
    Type Parameters
    TNode

    T

    Parameters
    source
    HierarchyIterable<TNode, T>

    Returns
    HierarchyQuery<TNode, T>

    _from(source, provider)

    Declaration
    protected _from<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
    OrderedHierarchyQuery<TNode, T>

    _from(source, provider)

    Declaration
    protected _from<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
    HierarchyQuery<TNode, T>

    _from(source)

    Declaration
    protected _from<T>(source: OrderedIterable<T>): OrderedQuery<T>;
    Type Parameters
    T

    Parameters
    source
    OrderedIterable<T>

    Returns
    OrderedQuery<T>

    _from(source)

    Declaration
    protected _from<T extends readonly unknown[] | []>(source: Iterable<T>): Query<T>;
    Type Parameters
    T

    Parameters
    source
    Iterable<T>

    Returns
    Query<T>

    _from(source)

    Declaration
    protected _from<T>(source: Iterable<T>): Query<T>;
    Type Parameters
    T

    Parameters
    source
    Iterable<T>

    Returns
    Query<T>

    [Symbol.iterator]()

    Declaration
    [Symbol.iterator](): Iterator<T>;
    Returns
    Iterator<T>

    append(value)

    Creates a subquery for the elements of this Query with the provided value appended to the end.

    Declaration
    append(value: T): UnorderedQueryFlow<this, T>;
    Parameters
    value
    T

    The value to append. Subquery

    Returns
    UnorderedQueryFlow<this, T>

    average()

    Computes the average for a series of numbers.

    Scalar

    Declaration
    average(): T extends number ? number : never;
    Returns
    T extends number ? number : never

    average(elementSelector)

    Computes the average for a series of numbers.

    Scalar

    Declaration
    average(elementSelector: (element: T) => number): number;
    Parameters
    elementSelector
    (element: T) => number

    Returns
    number

    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) => boolean): [UnorderedQueryFlow<this, T>, UnorderedQueryFlow<this, T>];
    Parameters
    predicate
    (element: T, offset: number) => boolean

    The predicate used to match elements. Scalar

    Returns
    [UnorderedQueryFlow<this, T>, UnorderedQueryFlow<this, T>]

    concat(right)

    Creates a subquery that concatenates this Query with another Iterable.

    Declaration
    concat<R extends Iterable<T>>(right: R): MergeQueryFlow<this, R, T>;
    Type Parameters
    R

    Parameters
    right
    R

    A Iterable object. Subquery

    Returns
    MergeQueryFlow<this, R, T>

    concat(right)

    Creates a subquery that concatenates this Query with another Iterable.

    Declaration
    concat(right: Iterable<T>): Query<T>;
    Parameters
    right
    Iterable<T>

    A Iterable object. Subquery

    Returns
    Query<T>

    consume(iterator, options)

    Creates a Query that, when iterated, consumes the provided Iterator.

    Declaration
    static consume<T>(iterator: Iterator<T>, options?: ConsumeOptions): Query<T>;
    Type Parameters
    T

    Parameters
    iterator
    Iterator<T>

    An Iterator object. Query

    options
    ConsumeOptions

    Returns
    Query<T>

    continuous(value)

    Creates a Query that repeats the provided value forever.

    Declaration
    static continuous<T>(value: T): Query<T>;
    Type Parameters
    T

    Parameters
    value
    T

    The value for each element of the Query. Query

    Returns
    Query<T>

    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(dest: T[], start?: number, count?: number): T[];
    Parameters
    dest
    T[]

    The destination array.

    start
    number

    The offset into the array at which to start writing.

    count
    number

    The number of elements to write to the array. Scalar

    Returns
    T[]

    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>>(dest: U, start?: number, count?: number): U;
    Type Parameters
    U

    Parameters
    dest
    U

    The destination array.

    start
    number

    The offset into the array at which to start writing.

    count
    number

    The number of elements to write to the array. Scalar

    Returns
    U

    corresponds(right, equaler)

    Computes a scalar value indicating whether every element in this Query corresponds to a matching element in another Iterable at the same position.

    Declaration
    corresponds(right: Iterable<T>, equaler?: EqualityComparison<T> | Equaler<T>): boolean;
    Parameters
    right
    Iterable<T>

    A Iterable object.

    equaler
    EqualityComparison<T> | Equaler<T>

    An optional callback used to compare the equality of two elements. Scalar

    Returns
    boolean

    corresponds(right, equaler)

    Computes a scalar value indicating whether every element in this Query corresponds to a matching element in another Iterable at the same position.

    Declaration
    corresponds<U>(right: Iterable<U>, equaler: (left: T, right: U) => boolean): boolean;
    Type Parameters
    U

    Parameters
    right
    Iterable<U>

    A Iterable object.

    equaler
    (left: T, right: U) => boolean

    An optional callback used to compare the equality of two elements. Scalar

    Returns
    boolean

    correspondsBy(right, keySelector, keyEqualer)

    Computes a scalar value indicating whether every element in this Query corresponds to a matching element in another Iterable at the same position.

    Declaration
    correspondsBy<K>(right: Iterable<T>, keySelector: (element: T) => K, keyEqualer?: Equaler<K>): boolean;
    Type Parameters
    K

    Parameters
    right
    Iterable<T>

    A Iterable object.

    keySelector
    (element: T) => K

    A callback used to select the key for each element.

    keyEqualer
    Equaler<K>

    An Equaler used to compare the equality of two keys. Scalar

    Returns
    boolean

    correspondsBy(right, leftKeySelector, rightKeySelector, keyEqualer)

    Computes a scalar value indicating whether the key for every element in this Query corresponds to a matching key in right at the same position.

    Declaration
    correspondsBy<U, K>(right: Iterable<U>, leftKeySelector: (element: T) => K, rightKeySelector: (element: U) => K, keyEqualer?: EqualityComparison<K> | Equaler<K>): boolean;
    Type Parameters
    U

    K

    Parameters
    right
    Iterable<U>

    A Iterable object.

    leftKeySelector
    (element: T) => K

    A callback used to select the key for each element in this Query.

    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
    boolean

    count(predicate)

    Counts the number of elements in the Query, optionally filtering elements using the supplied callback.

    Declaration
    count(predicate?: (element: T) => boolean): number;
    Parameters
    predicate
    (element: T) => boolean

    An optional callback used to match each element. Scalar

    Returns
    number

    defaultIfEmpty(defaultValue)

    Creates a subquery that contains the provided default value if this Query contains no elements.

    Declaration
    defaultIfEmpty(defaultValue: T): UnorderedQueryFlow<this, T>;
    Parameters
    defaultValue
    T

    The default value. Subquery

    Returns
    UnorderedQueryFlow<this, T>

    distinct(equaler)

    Creates a subquery for the distinct elements of this Query.

    Declaration
    distinct(equaler?: Equaler<T>): UnorderedQueryFlow<this, T>;
    Parameters
    equaler
    Equaler<T>

    An Equaler object used to compare key equality. Subquery

    Returns
    UnorderedQueryFlow<this, T>

    distinctBy(keySelector, keyEqualer)

    Creates a subquery for the distinct elements of this Query.

    Declaration
    distinctBy<K>(keySelector: (value: T) => K, keyEqualer?: Equaler<K>): UnorderedQueryFlow<this, T>;
    Type Parameters
    K

    Parameters
    keySelector
    (value: T) => K

    A callback used to select the key to determine uniqueness.

    keyEqualer
    Equaler<K>

    An Equaler object used to compare key equality. Subquery

    Returns
    UnorderedQueryFlow<this, T>

    drop(count)

    Creates a subquery containing all elements except the first elements up to the supplied count.

    Declaration
    drop(count: number): UnorderedQueryFlow<this, T>;
    Parameters
    count
    number

    The number of elements to drop. Subquery

    Returns
    UnorderedQueryFlow<this, T>

    dropRight(count)

    Creates a subquery containing all elements except the last elements up to the supplied count.

    Declaration
    dropRight(count: number): UnorderedQueryFlow<this, T>;
    Parameters
    count
    number

    The number of elements to drop. Subquery

    Returns
    UnorderedQueryFlow<this, T>

    dropUntil(predicate)

    Creates a subquery containing all elements except the first elements that don't match the supplied predicate.

    Declaration
    dropUntil(predicate: (element: T) => boolean): UnorderedQueryFlow<this, T>;
    Parameters
    predicate
    (element: T) => boolean

    A callback used to match each element.

    Returns
    UnorderedQueryFlow<this, T>

    dropWhile(predicate)

    Creates a subquery containing all elements except the first elements that match the supplied predicate.

    Declaration
    dropWhile(predicate: (element: T) => boolean): UnorderedQueryFlow<this, T>;
    Parameters
    predicate
    (element: T) => boolean

    A callback used to match each element.

    Returns
    UnorderedQueryFlow<this, T>

    elementAt(offset)

    Finds the value in the Query at the provided offset. A negative offset starts from the last element.

    Declaration
    elementAt(offset: number | Index): T | undefined;
    Parameters
    offset
    number | Index

    An offset. Scalar

    Returns
    T | undefined

    empty()

    Creates a Query with no elements.

    Query

    Declaration
    static empty<T>(): Query<T>;
    Type Parameters
    T

    Returns
    Query<T>

    endsWith(right, equaler)

    Computes a scalar value indicating whether the elements of this Query end with the same sequence of elements in another Iterable.

    Declaration
    endsWith(right: Iterable<T>, equaler?: EqualityComparison<T> | Equaler<T>): boolean;
    Parameters
    right
    Iterable<T>

    A Iterable object.

    equaler
    EqualityComparison<T> | Equaler<T>

    A callback used to compare the equality of two elements. Scalar

    Returns
    boolean

    endsWith(right, equaler)

    Computes a scalar value indicating whether the elements of this Query end with the same sequence of elements in another Iterable.

    Declaration
    endsWith<U>(right: Iterable<U>, equaler: (left: T, right: U) => boolean): boolean;
    Type Parameters
    U

    Parameters
    right
    Iterable<U>

    A Iterable object.

    equaler
    (left: T, right: U) => boolean

    A callback used to compare the equality of two elements. Scalar

    Returns
    boolean

    every(predicate)

    Computes a scalar value indicating whether all elements of the Query match the supplied callback.

    Declaration
    every<U extends T>(predicate: (element: T) => element is U): this is Query<U>;
    Type Parameters
    U

    Parameters
    predicate
    (element: T) => element is U

    A callback used to match each element. Scalar

    Returns
    this is Query<U>

    every(predicate)

    Computes a scalar value indicating whether all elements of the Query match the supplied callback.

    Declaration
    every(predicate: (element: T) => boolean): boolean;
    Parameters
    predicate
    (element: T) => boolean

    A callback used to match each element. Scalar

    Returns
    boolean

    except(right, equaler)

    Creates a subquery for the set difference between this and another Iterable.

    Declaration
    except(right: Iterable<T>, equaler?: Equaler<T>): UnorderedQueryFlow<this, T>;
    Parameters
    right
    Iterable<T>

    A Iterable object.

    equaler
    Equaler<T>

    An Equaler object used to compare equality. Subquery

    Returns
    UnorderedQueryFlow<this, T>

    exceptBy(right, keySelector, keyEqualer)

    Creates a subquery for the set difference between this and another Iterable, where set identity is determined by the selected key.

    Declaration
    exceptBy<K>(right: Iterable<T>, keySelector: (element: T) => K, keyEqualer?: Equaler<K>): UnorderedQueryFlow<this, T>;
    Type Parameters
    K

    Parameters
    right
    Iterable<T>

    A Iterable object.

    keySelector
    (element: T) => K

    A callback used to select the key for each element.

    keyEqualer
    Equaler<K>

    An Equaler object used to compare key equality. Subquery

    Returns
    UnorderedQueryFlow<this, T>

    exclude(values)

    Creates a subquery with every instance of the specified value removed.

    Declaration
    exclude(...values: [T, ...T[]]): UnorderedQueryFlow<this, T>;
    Parameters
    values
    [T, ...T[]]

    The values to exclude. Subquery

    Returns
    UnorderedQueryFlow<this, T>

    filter(predicate)

    Creates a subquery whose elements match the supplied predicate.

    Declaration
    filter<U extends T>(predicate: (element: T, offset: number) => element is U): UnorderedQueryFlow<this, U>;
    Type Parameters
    U

    Parameters
    predicate
    (element: T, offset: number) => element is U

    A callback used to match each element.

    Returns
    UnorderedQueryFlow<this, U>

    filter(predicate)

    Creates a subquery whose elements match the supplied predicate.

    Declaration
    filter(predicate: (element: T, offset: number) => boolean): UnorderedQueryFlow<this, T>;
    Parameters
    predicate
    (element: T, offset: number) => boolean

    A callback used to match each element.

    Returns
    UnorderedQueryFlow<this, T>

    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) => boolean): UnorderedQueryFlow<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) => boolean

    A callback used to match each key.

    Returns
    UnorderedQueryFlow<this, T>

    filterDefined()

    Creates a subquery whose elements are neither null nor undefined.

    Subquery

    Declaration
    filterDefined(): UnorderedQueryFlow<this, NonNullable<T>>;
    Returns
    UnorderedQueryFlow<this, NonNullable<T>>

    filterDefinedBy(keySelector)

    Creates a subquery where the selected key for each element is neither null nor undefined.

    Declaration
    filterDefinedBy<K>(keySelector: (element: T) => K): UnorderedQueryFlow<this, T>;
    Type Parameters
    K

    Parameters
    keySelector
    (element: T) => K

    A callback used to select the key for each element.

    Returns
    UnorderedQueryFlow<this, T>

    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): UnorderedQueryFlow<this, U>;
    Type Parameters
    U

    Parameters
    predicate
    (element: T, offset: number) => element is U

    A callback used to match each element.

    Returns
    UnorderedQueryFlow<this, U>

    filterNot(predicate)

    Creates a subquery whose elements do not match the supplied predicate.

    Declaration
    filterNot(predicate: (element: T, offset: number) => boolean): UnorderedQueryFlow<this, T>;
    Parameters
    predicate
    (element: T, offset: number) => boolean

    A callback used to match each element.

    Returns
    UnorderedQueryFlow<this, T>

    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) => boolean): UnorderedQueryFlow<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) => boolean

    A callback used to match each key.

    Returns
    UnorderedQueryFlow<this, T>

    filterNotDefinedBy(keySelector)

    Creates a subquery where the selected key for each element is either null or undefined.

    Declaration
    filterNotDefinedBy<K>(keySelector: (element: T) => K): UnorderedQueryFlow<this, T>;
    Type Parameters
    K

    Parameters
    keySelector
    (element: T) => K

    A callback used to select the key for each element.

    Returns
    UnorderedQueryFlow<this, T>

    first(predicate)

    Gets the first element in the Query, optionally filtering elements using the supplied callback.

    Declaration
    first<U extends T>(predicate: (element: T) => element is U): U | undefined;
    Type Parameters
    U

    Parameters
    predicate
    (element: T) => element is U

    An optional callback used to match each element. Scalar

    Returns
    U | undefined

    first(predicate)

    Gets the first element in the Query, optionally filtering elements using the supplied callback.

    Declaration
    first(predicate?: (element: T) => boolean): T | undefined;
    Parameters
    predicate
    (element: T) => boolean

    An optional callback used to match each element. Scalar

    Returns
    T | undefined

    flatMap(projection)

    Creates a subquery that iterates the results of applying a callback to each element.

    Declaration
    flatMap<U>(projection: (element: T) => Iterable<U>): Query<U>;
    Type Parameters
    U

    Parameters
    projection
    (element: T) => Iterable<U>

    A callback used to map each element into a Iterable.

    Returns
    Query<U>

    flatMap(projection, resultSelector)

    Creates a subquery that iterates the results of applying a callback to each element.

    Declaration
    flatMap<U, R>(projection: (element: T) => Iterable<U>, resultSelector: (element: T, innerElement: U) => R): Query<R>;
    Type Parameters
    U

    R

    Parameters
    projection
    (element: T) => Iterable<U>

    A callback used to map each element into a Iterable.

    resultSelector
    (element: T, innerElement: U) => R

    An optional callback used to map the outer and projected inner elements.

    Returns
    Query<R>

    forEach(callback)

    Invokes a callback for each element of the Query.

    Declaration
    forEach(callback: (element: T, offset: number) => void): void;
    Parameters
    callback
    (element: T, offset: number) => void

    The callback to invoke. Scalar

    Returns
    void

    from(source)

    Creates a Query from a Iterable source. Query

    Declaration
    static from<TNode, T extends TNode>(source: OrderedHierarchyIterable<TNode, T>): OrderedHierarchyQuery<TNode, T>;
    Type Parameters
    TNode

    T

    Parameters
    source
    OrderedHierarchyIterable<TNode, T>

    Returns
    OrderedHierarchyQuery<TNode, T>

    from(source)

    Declaration
    static from<TNode, T extends TNode>(source: HierarchyIterable<TNode, T>): HierarchyQuery<TNode, T>;
    Type Parameters
    TNode

    T

    Parameters
    source
    HierarchyIterable<TNode, T>

    Returns
    HierarchyQuery<TNode, T>

    from(source, provider)

    Declaration
    static from<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
    OrderedHierarchyQuery<TNode, T>

    from(source, provider)

    Declaration
    static from<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
    HierarchyQuery<TNode, T>

    from(source)

    Declaration
    static from<T>(source: OrderedIterable<T>): OrderedQuery<T>;
    Type Parameters
    T

    Parameters
    source
    OrderedIterable<T>

    Returns
    OrderedQuery<T>

    from(source)

    Declaration
    static from<T extends readonly unknown[] | []>(source: Iterable<T>): Query<T>;
    Type Parameters
    T

    Parameters
    source
    Iterable<T>

    Returns
    Query<T>

    from(source)

    Declaration
    static from<T>(source: Iterable<T>): Query<T>;
    Type Parameters
    T

    Parameters
    source
    Iterable<T>

    Returns
    Query<T>

    fullJoin(inner, outerKeySelector, innerKeySelector, resultSelector, keyEqualer)

    Creates a subquery for the correlated elements of this Query and another Iterable.

    Declaration
    fullJoin<I, K, R>(inner: Iterable<I>, outerKeySelector: (element: T) => K, innerKeySelector: (element: I) => K, resultSelector: (outer: T | undefined, inner: I | undefined) => R, keyEqualer?: Equaler<K>): Query<R>;
    Type Parameters
    I

    K

    R

    Parameters
    inner
    Iterable<I>

    A Iterable object.

    outerKeySelector
    (element: T) => K

    A callback used to select the key for an element in this Query.

    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) => R

    A callback used to select the result for the correlated elements.

    keyEqualer
    Equaler<K>

    An Equaler object used to compare key equality. Join

    Returns
    Query<R>

    generate(count, generator)

    Creates a Query whose values are provided by a callback executed a provided number of times.

    Declaration
    static generate<T>(count: number, generator: (offset: number) => T): Query<T>;
    Type Parameters
    T

    Parameters
    count
    number

    The number of times to execute the callback.

    generator
    (offset: number) => T

    The callback to execute. Query

    Returns
    Query<T>

    groupBy(keySelector, keyEqualer)

    Groups each element of this Query by its key.

    Declaration
    groupBy<K>(keySelector: (element: T) => K, keyEqualer?: Equaler<K>): GroupedQueryFlow<this, K, T>;
    Type Parameters
    K

    Parameters
    keySelector
    (element: T) => K

    A callback used to select the key for an element.

    keyEqualer
    Equaler<K>

    An Equaler object used to compare key equality. Subquery

    Returns
    GroupedQueryFlow<this, K, T>

    groupBy(keySelector, elementSelector, keyEqualer)

    Groups each element by its key.

    Declaration
    groupBy<K, V>(keySelector: (element: T) => K, elementSelector: (element: T) => V, keyEqualer?: Equaler<K>): GroupedQueryFlow<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) => V

    A callback used to select a value for an element.

    keyEqualer
    Equaler<K>

    An Equaler object used to compare key equality. Subquery

    Returns
    GroupedQueryFlow<this, K, V>

    groupBy(keySelector, elementSelector, resultSelector, keyEqualer)

    Groups each element by its key.

    Declaration
    groupBy<K, V, R>(keySelector: (element: T) => K, elementSelector: (element: T) => V, resultSelector: (key: K, elements: Query<V>) => R, keyEqualer?: Equaler<K>): Query<R>;
    Type Parameters
    K

    V

    R

    Parameters
    keySelector
    (element: T) => K

    A callback used to select the key for an element.

    elementSelector
    (element: T) => V

    A callback used to select a value for an element.

    resultSelector
    (key: K, elements: Query<V>) => R

    A callback used to select a result from a group.

    keyEqualer
    Equaler<K>

    An Equaler object used to compare key equality. Subquery

    Returns
    Query<R>

    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>) => R, keyEqualer?: Equaler<K>): Query<R>;
    Type Parameters
    K

    R

    Parameters
    keySelector
    (element: T) => K

    A callback used to select the key for an element.

    elementSelector
    undefined

    A callback used to select a value for an element.

    resultSelector
    (key: K, elements: Query<T>) => R

    A callback used to select a result from a group.

    keyEqualer
    Equaler<K>

    An Equaler object used to compare key equality. Subquery

    Returns
    Query<R>

    groupJoin(inner, outerKeySelector, innerKeySelector, resultSelector, keyEqualer)

    Creates a grouped subquery for the correlated elements of this Query and another Iterable object.

    Declaration
    groupJoin<I, K, R>(inner: Iterable<I>, outerKeySelector: (element: T) => K, innerKeySelector: (element: I) => K, resultSelector: (outer: T, inner: Query<I>) => R, keyEqualer?: Equaler<K>): Query<R>;
    Type Parameters
    I

    K

    R

    Parameters
    inner
    Iterable<I>

    A Iterable object.

    outerKeySelector
    (element: T) => K

    A callback used to select the key for an element in this Query.

    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>) => R

    A callback used to select the result for the correlated elements.

    keyEqualer
    Equaler<K>

    An Equaler object used to compare key equality. Join

    Returns
    Query<R>

    includes(value, equaler)

    Computes a scalar value indicating whether the provided value is included in the Query.

    Declaration
    includes(value: T, equaler?: EqualityComparison<T> | Equaler<T>): boolean;
    Parameters
    value
    T

    A value.

    equaler
    EqualityComparison<T> | Equaler<T>

    An optional callback used to compare the equality of two elements. Scalar

    Returns
    boolean

    includes(value, equaler)

    Computes a scalar value indicating whether the provided value is included in the Query.

    Declaration
    includes<U>(value: U, equaler: (left: T, right: U) => boolean): 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
    boolean

    includesSequence(right, equaler)

    Computes a scalar value indicating whether the elements of this Query include an exact sequence of elements from another Iterable.

    Declaration
    includesSequence(right: Iterable<T>, equaler?: EqualityComparison<T> | Equaler<T>): boolean;
    Parameters
    right
    Iterable<T>

    A Iterable object.

    equaler
    EqualityComparison<T> | Equaler<T>

    A callback used to compare the equality of two elements. Scalar

    Returns
    boolean

    includesSequence(right, equaler)

    Computes a scalar value indicating whether the elements of this Query include an exact sequence of elements from another Iterable.

    Declaration
    includesSequence<U>(right: Iterable<U>, equaler: (left: T, right: U) => boolean): boolean;
    Type Parameters
    U

    Parameters
    right
    Iterable<U>

    A Iterable object.

    equaler
    (left: T, right: U) => boolean

    A callback used to compare the equality of two elements. Scalar

    Returns
    boolean

    intersect(right, equaler)

    Creates a subquery for the set intersection of this Query and another Iterable.

    Declaration
    intersect<R extends Iterable<T>>(right: R, equaler?: Equaler<T>): MergeQueryFlow<this, R, T>;
    Type Parameters
    R

    Parameters
    right
    R

    A Iterable object.

    equaler
    Equaler<T>

    An Equaler object used to compare equality. Subquery

    Returns
    MergeQueryFlow<this, R, T>

    intersect(right, equaler)

    Declaration
    intersect(right: Iterable<T>, equaler?: Equaler<T>): Query<T>;
    Parameters
    right
    Iterable<T>

    equaler
    Equaler<T>

    Returns
    Query<T>

    intersectBy(right, keySelector, keyEqualer)

    Creates a subquery for the set intersection of this Query and another Iterable, where set identity is determined by the selected key.

    Declaration
    intersectBy<K, R extends Iterable<T>>(right: R, keySelector: (element: T) => K, keyEqualer?: Equaler<K>): MergeQueryFlow<this, R, T>;
    Type Parameters
    K

    R

    Parameters
    right
    R

    A Iterable object.

    keySelector
    (element: T) => K

    A callback used to select the key for each element.

    keyEqualer
    Equaler<K>

    An Equaler object used to compare key equality. Subquery

    Returns
    MergeQueryFlow<this, R, T>

    intersectBy(right, keySelector, keyEqualer)

    Creates a subquery for the set intersection of this Query and another Iterable, where set identity is determined by the selected key.

    Declaration
    intersectBy<K>(right: Iterable<T>, keySelector: (element: T) => K, keyEqualer?: Equaler<K>): Query<T>;
    Type Parameters
    K

    Parameters
    right
    Iterable<T>

    A Iterable object.

    keySelector
    (element: T) => K

    A callback used to select the key for each element.

    keyEqualer
    Equaler<K>

    An Equaler object used to compare key equality. Subquery

    Returns
    Query<T>

    into(callback)

    Pass the entire Query 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
    R

    join(inner, outerKeySelector, innerKeySelector, resultSelector, keyEqualer)

    Creates a subquery for the correlated elements of this Query and another Iterable.

    Declaration
    join<I, K, R>(inner: Iterable<I>, outerKeySelector: (element: T) => K, innerKeySelector: (element: I) => K, resultSelector: (outer: T, inner: I) => R, keyEqualer?: Equaler<K>): Query<R>;
    Type Parameters
    I

    K

    R

    Parameters
    inner
    Iterable<I>

    A Iterable object.

    outerKeySelector
    (element: T) => K

    A callback used to select the key for an element in this Query.

    innerKeySelector
    (element: I) => K

    A callback used to select the key for an element in the other Iterable.

    resultSelector
    (outer: T, inner: I) => R

    A callback used to select the result for the correlated elements.

    keyEqualer
    Equaler<K>

    An Equaler object used to compare key equality. Join

    Returns
    Query<R>

    last(predicate)

    Gets the last element in the Query, optionally filtering elements using the supplied callback.

    Declaration
    last<U extends T>(predicate: (element: T) => element is U): U | undefined;
    Type Parameters
    U

    Parameters
    predicate
    (element: T) => element is U

    An optional callback used to match each element. Scalar

    Returns
    U | undefined

    last(predicate)

    Gets the last element in the Query, optionally filtering elements using the supplied callback.

    Declaration
    last(predicate?: (element: T) => boolean): T | undefined;
    Parameters
    predicate
    (element: T) => boolean

    An optional callback used to match each element. Scalar

    Returns
    T | undefined

    map(selector)

    Creates a subquery by applying a callback to each element.

    Declaration
    map<U>(selector: (element: T, offset: number) => U): Query<U>;
    Type Parameters
    U

    Parameters
    selector
    (element: T, offset: number) => U

    A callback used to map each element.

    Returns
    Query<U>

    materialize()

    Eagerly evaluate the Query, returning a new Query. Subquery

    Declaration
    materialize(): UnorderedQueryFlow<this, T>;
    Returns
    UnorderedQueryFlow<this, T>

    max(comparer)

    Gets the maximum element in the Query, optionally comparing elements using the supplied callback.

    Declaration
    max(comparer?: Comparison<T> | Comparer<T>): T | undefined;
    Parameters
    comparer
    Comparison<T> | Comparer<T>

    An optional callback used to compare two elements. Scalar

    Returns
    T | undefined

    maxBy(keySelector, keyComparer)

    Gets the maximum element by its key in the Query, optionally comparing the keys of each element using the supplied callback.

    Declaration
    maxBy<K>(keySelector: (element: T) => K, keyComparer?: Comparison<K> | Comparer<K>): T | undefined;
    Type Parameters
    K

    Parameters
    keySelector
    (element: T) => K

    A callback used to choose the key to compare.

    keyComparer
    Comparison<K> | Comparer<K>

    An optional callback used to compare the keys. Scalar

    Returns
    T | undefined

    min(comparer)

    Gets the minimum element in the Query, optionally comparing elements using the supplied callback.

    Declaration
    min(comparer?: Comparison<T> | Comparer<T>): T | undefined;
    Parameters
    comparer
    Comparison<T> | Comparer<T>

    An optional callback used to compare two elements. Scalar

    Returns
    T | undefined

    minBy(keySelector, keyComparer)

    Gets the minimum element by its key in the Query, optionally comparing the keys of each element using the supplied callback.

    Declaration
    minBy<K>(keySelector: (element: T) => K, keyComparer?: Comparison<K> | Comparer<K>): T | undefined;
    Type Parameters
    K

    Parameters
    keySelector
    (element: T) => K

    A callback used to choose the key to compare.

    keyComparer
    Comparison<K> | Comparer<K>

    An optional callback used to compare the keys. Scalar

    Returns
    T | undefined

    nth(offset)

    Finds the value in the Query at the provided offset. A negative offset starts from the last element.

    NOTE: This is an alias for elementAt.

    Declaration
    nth(offset: number | Index): T | undefined;
    Parameters
    offset
    number | Index

    An offset. Scalar

    Returns
    T | undefined

    of(elements)

    Creates a Query for the provided elements.

    Declaration
    static of<T>(...elements: T[]): Query<T>;
    Type Parameters
    T

    Parameters
    elements
    T[]

    The elements of the Query. Query

    Returns
    Query<T>

    once(value)

    Creates a Query over a single element.

    Declaration
    static once<T>(value: T): Query<T>;
    Type Parameters
    T

    Parameters
    value
    T

    The only element for the Query. Query

    Returns
    Query<T>

    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>): OrderedQueryFlow<this, T>;
    Type Parameters
    K

    Parameters
    keySelector
    (element: T) => K

    A callback used to select the key for an element.

    comparer
    Comparison<K> | Comparer<K>

    An optional callback used to compare two keys. Order

    Returns
    OrderedQueryFlow<this, T>

    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>): OrderedQueryFlow<this, T>;
    Type Parameters
    K

    Parameters
    keySelector
    (element: T) => K

    A callback used to select the key for an element.

    comparer
    Comparison<K> | Comparer<K>

    An optional callback used to compare two keys. Order

    Returns
    OrderedQueryFlow<this, T>

    pageBy(pageSize)

    Creates a subquery that splits this Query 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): PagedQueryFlow<this, T>;
    Parameters
    pageSize
    number

    The number of elements per page. Subquery

    Returns
    PagedQueryFlow<this, T>

    pageBy(pageSize, pageSelector)

    Creates a subquery that splits this Query 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): Query<R>;
    Type Parameters
    R

    Parameters
    pageSize
    number

    The number of elements per page. Subquery

    pageSelector
    (page: number, offset: number, values: UnorderedQueryFlow<this, T>) => R

    Returns
    Query<R>

    patch(start, skipCount, range)

    Creates a subquery for the elements of this Query with the provided range patched into the results.

    Declaration
    patch(start: number, skipCount?: number, range?: Iterable<T>): UnorderedQueryFlow<this, T>;
    Parameters
    start
    number

    The offset at which to patch the range.

    skipCount
    number

    The number of elements to skip from start.

    range
    Iterable<T>

    The range to patch into the result. Subquery

    Returns
    UnorderedQueryFlow<this, T>

    prepend(value)

    Creates a subquery for the elements of this Query with the provided value prepended to the beginning.

    Declaration
    prepend(value: T): UnorderedQueryFlow<this, T>;
    Parameters
    value
    T

    The value to prepend. Subquery

    Returns
    UnorderedQueryFlow<this, T>

    range(start, end, increment)

    Creates a Query over a range of numbers.

    Declaration
    static range(start: number, end: number, increment?: number): Query<number>;
    Parameters
    start
    number

    The starting number of the range.

    end
    number

    The ending number of the range.

    increment
    number

    The amount by which to change between each itereated value. Query

    Returns
    Query<number>

    reduce(accumulator)

    Computes a scalar value by applying an accumulator callback over each element.

    Declaration
    reduce(accumulator: (current: T, element: T, offset: number) => T): T;
    Parameters
    accumulator
    (current: T, element: T, offset: number) => T

    the callback used to compute the result.

    Returns
    T

    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) => U, seed: U, resultSelector?: (result: U, count: number) => U): U;
    Type Parameters
    U

    Parameters
    accumulator
    (current: U, element: T, offset: number) => U

    the callback used to compute the result.

    seed
    U

    An optional seed value. Scalar

    resultSelector
    (result: U, count: number) => U

    Returns
    U

    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) => U, seed: U, resultSelector: (result: U, count: number) => R): R;
    Type Parameters
    U

    R

    Parameters
    accumulator
    (current: U, element: T, offset: number) => U

    the callback used to compute the result.

    seed
    U

    An optional seed value.

    resultSelector
    (result: U, count: number) => R

    An optional callback used to compute the final result. Scalar

    Returns
    R

    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) => T): T;
    Parameters
    accumulator
    (current: T, element: T, offset: number) => T

    the callback used to compute the result. Scalar

    Returns
    T

    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) => U, seed: U, resultSelector?: (result: U, count: number) => U): U;
    Type Parameters
    U

    Parameters
    accumulator
    (current: U, element: T, offset: number) => U

    the callback used to compute the result.

    seed
    U

    An optional seed value. Scalar

    resultSelector
    (result: U, count: number) => U

    Returns
    U

    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) => U, seed: U, resultSelector: (result: U, count: number) => R): R;
    Type Parameters
    U

    R

    Parameters
    accumulator
    (current: U, element: T, offset: number) => U

    the callback used to compute the result.

    seed
    U

    An optional seed value.

    resultSelector
    (result: U, count: number) => R

    An optional callback used to compute the final result. Scalar

    Returns
    R

    relativeComplement(right, equaler)

    Creates a subquery for the set difference between this and another Iterable.

    NOTE: This is an alias for except.

    Declaration
    relativeComplement(right: Iterable<T>, equaler?: Equaler<T>): UnorderedQueryFlow<this, T>;
    Parameters
    right
    Iterable<T>

    A Iterable object.

    equaler
    Equaler<T>

    An Equaler object used to compare equality. Subquery

    Returns
    UnorderedQueryFlow<this, T>

    relativeComplementBy(right, keySelector, keyEqualer)

    Creates a subquery for the set difference between this and another Iterable, where set identity is determined by the selected key.

    NOTE: This is an alias for exceptBy.

    Declaration
    relativeComplementBy<K>(right: Iterable<T>, keySelector: (element: T) => K, keyEqualer?: Equaler<K>): UnorderedQueryFlow<this, T>;
    Type Parameters
    K

    Parameters
    right
    Iterable<T>

    A Iterable object.

    keySelector
    (element: T) => K

    A callback used to select the key for each element.

    keyEqualer
    Equaler<K>

    An Equaler object used to compare key equality. Subquery

    Returns
    UnorderedQueryFlow<this, T>

    repeat(value, count)

    Creates a Query for a value repeated a provided number of times.

    Declaration
    static repeat<T>(value: T, count: number): Query<T>;
    Type Parameters
    T

    Parameters
    value
    T

    The value for each element of the Query.

    count
    number

    The number of times to repeat the value. Query

    Returns
    Query<T>

    reverse()

    Creates a subquery whose elements are in the reverse order.

    Subquery

    Declaration
    reverse(): UnorderedQueryFlow<this, T>;
    Returns
    UnorderedQueryFlow<this, T>

    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) => T): Query<T>;
    Parameters
    accumulator
    (current: T, element: T, offset: number) => T

    The callback used to compute each result.

    Returns
    Query<T>

    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) => U, seed: U): Query<U>;
    Type Parameters
    U

    Parameters
    accumulator
    (current: U, element: T, offset: number) => U

    The callback used to compute each result.

    seed
    U

    An optional seed value. Subquery

    Returns
    Query<U>

    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) => T): Query<T>;
    Parameters
    accumulator
    (current: T, element: T, offset: number) => T

    The callback used to compute each result.

    Returns
    Query<T>

    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) => U, seed?: U): Query<U>;
    Type Parameters
    U

    Parameters
    accumulator
    (current: U, element: T, offset: number) => U

    The callback used to compute each result.

    seed
    U

    An optional seed value. Subquery

    Returns
    Query<U>

    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) => U): Query<U>;
    Type Parameters
    U

    Parameters
    selector
    (element: T, offset: number) => U

    A callback used to map each element.

    Returns
    Query<U>

    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) => Iterable<U>): Query<U>;
    Type Parameters
    U

    Parameters
    projection
    (element: T) => Iterable<U>

    A callback used to map each element into an iterable.

    Returns
    Query<U>

    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) => Iterable<U>, resultSelector: (element: T, innerElement: U) => R): Query<R>;
    Type Parameters
    U

    R

    Parameters
    projection
    (element: T) => Iterable<U>

    A callback used to map each element into an iterable.

    resultSelector
    (element: T, innerElement: U) => R

    An optional callback used to map the outer and projected inner elements.

    Returns
    Query<R>

    single(predicate)

    Gets the only element in the Query, or returns undefined.

    Declaration
    single<U extends T>(predicate: (element: T) => element is U): U | undefined;
    Type Parameters
    U

    Parameters
    predicate
    (element: T) => element is U

    An optional callback used to match each element. Scalar

    Returns
    U | undefined

    single(predicate)

    Gets the only element in the Query, or returns undefined.

    Declaration
    single(predicate?: (element: T) => boolean): T | undefined;
    Parameters
    predicate
    (element: T) => boolean

    An optional callback used to match each element. Scalar

    Returns
    T | undefined

    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): UnorderedQueryFlow<this, T>;
    Parameters
    count
    number

    The number of elements to skip. Subquery

    Returns
    UnorderedQueryFlow<this, T>

    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): UnorderedQueryFlow<this, T>;
    Parameters
    count
    number

    The number of elements to skip. Subquery

    Returns
    UnorderedQueryFlow<this, T>

    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) => boolean): UnorderedQueryFlow<this, T>;
    Parameters
    predicate
    (element: T) => boolean

    A callback used to match each element.

    Returns
    UnorderedQueryFlow<this, T>

    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) => boolean): UnorderedQueryFlow<this, T>;
    Parameters
    predicate
    (element: T) => boolean

    A callback used to match each element.

    Returns
    UnorderedQueryFlow<this, T>

    some(predicate)

    Computes a scalar value indicating whether the Query contains any elements, optionally filtering the elements using the supplied callback.

    Declaration
    some(predicate?: (element: T) => boolean): boolean;
    Parameters
    predicate
    (element: T) => boolean

    An optional callback used to match each element. Scalar

    Returns
    boolean

    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): [UnorderedQueryFlow<this, U>, UnorderedQueryFlow<this, T>];
    Type Parameters
    U

    Parameters
    predicate
    (element: T, offset: number) => element is U

    The predicate used to match elements. Scalar

    Returns
    [UnorderedQueryFlow<this, U>, UnorderedQueryFlow<this, T>]

    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) => boolean): [UnorderedQueryFlow<this, T>, UnorderedQueryFlow<this, T>];
    Parameters
    predicate
    (element: T, offset: number) => boolean

    The predicate used to match elements. Scalar

    Returns
    [UnorderedQueryFlow<this, T>, UnorderedQueryFlow<this, T>]

    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>): GroupedQueryFlow<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
    GroupedQueryFlow<this, K, T>

    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) => V, keyEqualer?: Equaler<K>): GroupedQueryFlow<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) => V

    A callback used to select a value for an element.

    keyEqualer
    Equaler<K>

    Returns
    GroupedQueryFlow<this, K, V>

    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) => V, spanSelector: (key: K, elements: Query<V>) => R, keyEqualer?: Equaler<K>): Query<R>;
    Type Parameters
    K

    V

    R

    Parameters
    keySelector
    (element: T) => K

    A callback used to select the key for an element.

    elementSelector
    (element: T) => V

    A callback used to select a value for an element.

    spanSelector
    (key: K, elements: Query<V>) => R

    A callback used to select a result from a contiguous range.

    keyEqualer
    Equaler<K>

    Returns
    Query<R>

    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>) => R, keyEqualer?: Equaler<K>): Query<R>;
    Type Parameters
    K

    R

    Parameters
    keySelector
    (element: T) => K

    A callback used to select the key for an element.

    elementSelector
    undefined

    A callback used to select a value for an element.

    spanSelector
    (key: K, elements: Query<T>) => R

    A callback used to select a result from a contiguous range.

    keyEqualer
    Equaler<K>

    Returns
    Query<R>

    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) => boolean): [UnorderedQueryFlow<this, T>, UnorderedQueryFlow<this, T>];
    Parameters
    predicate
    (element: T, offset: number) => boolean

    The predicate used to match elements. Scalar

    Returns
    [UnorderedQueryFlow<this, T>, UnorderedQueryFlow<this, T>]

    startsWith(right, equaler)

    Computes a scalar value indicating whether the elements of this Query start with the same sequence of elements in another Iterable.

    Declaration
    startsWith(right: Iterable<T>, equaler?: EqualityComparison<T> | Equaler<T>): boolean;
    Parameters
    right
    Iterable<T>

    A Iterable object.

    equaler
    EqualityComparison<T> | Equaler<T>

    A callback used to compare the equality of two elements. Scalar

    Returns
    boolean

    startsWith(right, equaler)

    Computes a scalar value indicating whether the elements of this Query start with the same sequence of elements in another Iterable.

    Declaration
    startsWith<U>(right: Iterable<U>, equaler: (left: T, right: U) => boolean): boolean;
    Type Parameters
    U

    Parameters
    right
    Iterable<U>

    A Iterable object.

    equaler
    (left: T, right: U) => boolean

    A callback used to compare the equality of two elements. Scalar

    Returns
    boolean

    sum()

    Computes the sum for a series of numbers.

    Scalar

    Declaration
    sum(): T extends number ? number : never;
    Returns
    T extends number ? number : never

    sum(elementSelector)

    Computes the sum for a series of numbers.

    Scalar

    Declaration
    sum(elementSelector: (element: T) => number): number;
    Parameters
    elementSelector
    (element: T) => number

    Returns
    number

    symmetricDifference(right, equaler)

    Creates a subquery for the symmetric difference between this and another Iterable.

    Declaration
    symmetricDifference<R extends Iterable<T>>(right: R, equaler?: Equaler<T>): MergeQueryFlow<this, R, T>;
    Type Parameters
    R

    Parameters
    right
    R

    A Iterable object.

    equaler
    Equaler<T>

    An Equaler object used to compare equality. Subquery

    Returns
    MergeQueryFlow<this, R, T>

    symmetricDifference(right, equaler)

    Creates a subquery for the symmetric difference between this and another Iterable.

    Declaration
    symmetricDifference(right: Iterable<T>, equaler?: Equaler<T>): Query<T>;
    Parameters
    right
    Iterable<T>

    A Iterable object.

    equaler
    Equaler<T>

    An Equaler object used to compare equality. Subquery

    Returns
    Query<T>

    symmetricDifferenceBy(right, keySelector, keyEqualer)

    Creates a subquery for the symmetric difference between this and another Iterable, where set identity is determined by the selected key.

    Declaration
    symmetricDifferenceBy<K, R extends Iterable<T>>(right: R, keySelector: (element: T) => K, keyEqualer?: Equaler<K>): MergeQueryFlow<this, R, T>;
    Type Parameters
    K

    R

    Parameters
    right
    R

    A Iterable object.

    keySelector
    (element: T) => K

    A callback used to select the key for each element.

    keyEqualer
    Equaler<K>

    An Equaler object used to compare key equality. Subquery

    Returns
    MergeQueryFlow<this, R, T>

    symmetricDifferenceBy(right, keySelector, keyEqualer)

    Creates a subquery for the symmetric difference between this and another Iterable, where set identity is determined by the selected key.

    Declaration
    symmetricDifferenceBy<K>(right: Iterable<T>, keySelector: (element: T) => K, keyEqualer?: Equaler<K>): Query<T>;
    Type Parameters
    K

    Parameters
    right
    Iterable<T>

    A Iterable object.

    keySelector
    (element: T) => K

    A callback used to select the key for each element.

    keyEqualer
    Equaler<K>

    An Equaler object used to compare key equality. Subquery

    Returns
    Query<T>

    take(count)

    Creates a subquery containing the first elements up to the supplied count.

    Declaration
    take(count: number): UnorderedQueryFlow<this, T>;
    Parameters
    count
    number

    The number of elements to take. Subquery

    Returns
    UnorderedQueryFlow<this, T>

    takeRight(count)

    Creates a subquery containing the last elements up to the supplied count.

    Declaration
    takeRight(count: number): UnorderedQueryFlow<this, T>;
    Parameters
    count
    number

    The number of elements to take. Subquery

    Returns
    UnorderedQueryFlow<this, T>

    takeUntil(predicate)

    Creates a subquery containing the first elements that do not match the supplied predicate.

    Declaration
    takeUntil(predicate: (element: T) => boolean): UnorderedQueryFlow<this, T>;
    Parameters
    predicate
    (element: T) => boolean

    A callback used to match each element.

    Returns
    UnorderedQueryFlow<this, T>

    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): UnorderedQueryFlow<this, U>;
    Type Parameters
    U

    Parameters
    predicate
    (element: T) => element is U

    A callback used to match each element.

    Returns
    UnorderedQueryFlow<this, U>

    takeWhile(predicate)

    Creates a subquery containing the first elements that match the supplied predicate.

    Declaration
    takeWhile(predicate: (element: T) => boolean): UnorderedQueryFlow<this, T>;
    Parameters
    predicate
    (element: T) => boolean

    A callback used to match each element.

    Returns
    UnorderedQueryFlow<this, T>

    tap(callback)

    Lazily invokes a callback as each element of the Query is iterated.

    Declaration
    tap(callback: (element: T, offset: number) => void): UnorderedQueryFlow<this, T>;
    Parameters
    callback
    (element: T, offset: number) => void

    The callback to invoke.

    Returns
    UnorderedQueryFlow<this, T>

    through(callback)

    Pass the entire Query to the provided callback, creating a new Query from the result.

    Declaration
    through<R extends Iterable<any>>(callback: (source: this) => R): QueryFlow<R, R extends Iterable<infer U> ? U : unknown>;
    Type Parameters
    R

    Parameters
    callback
    (source: this) => R

    A callback function.

    Returns
    QueryFlow<R, R extends Iterable<infer U> ? U : unknown>

    toArray()

    Creates an Array for the elements of the Query. Scalar

    Declaration
    toArray(): T[];
    Returns
    T[]

    toArray(elementSelector)

    Creates an Array for the elements of the Query.

    Declaration
    toArray<V>(elementSelector: (element: T) => V): V[];
    Type Parameters
    V

    Parameters
    elementSelector
    (element: T) => V

    A callback that selects a value for each element. Scalar

    Returns
    V[]

    toHashMap(keySelector, keyEqualer)

    Creates a Map for the elements of the Query.

    Declaration
    toHashMap<K>(keySelector: (element: T) => K, keyEqualer?: Equaler<K>): HashMap<K, T>;
    Type Parameters
    K

    Parameters
    keySelector
    (element: T) => K

    A callback used to select a key for each element.

    keyEqualer
    Equaler<K>

    An Equaler object used to compare key equality. Scalar

    Returns
    HashMap<K, T>

    toHashMap(keySelector, elementSelector, keyEqualer)

    Creates a Map for the elements of the Query.

    Declaration
    toHashMap<K, V>(keySelector: (element: T) => K, elementSelector: (element: T) => V, keyEqualer?: Equaler<K>): 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) => V

    A callback that selects a value for each element.

    keyEqualer
    Equaler<K>

    An Equaler object used to compare key equality. Scalar

    Returns
    HashMap<K, V>

    toHashSet(equaler)

    Creates a HashSet for the elements of the Query.

    Declaration
    toHashSet(equaler?: Equaler<T>): HashSet<T>;
    Parameters
    equaler
    Equaler<T>

    An Equaler object used to compare equality. Scalar

    Returns
    HashSet<T>

    toHashSet(elementSelector, equaler)

    Creates a HashSet for the elements of the Query.

    Declaration
    toHashSet<V>(elementSelector: (element: T) => V, equaler?: Equaler<V>): HashSet<V>;
    Type Parameters
    V

    Parameters
    elementSelector
    (element: T) => V

    A callback that selects a value for each element.

    equaler
    Equaler<V>

    An Equaler object used to compare equality. Scalar

    Returns
    HashSet<V>

    toHierarchy(provider)

    Creates a HierarchyQuery using the provided HierarchyProvider.

    Declaration
    toHierarchy<TNode extends (T extends TNode ? unknown : never)>(provider: HierarchyProvider<TNode>): HierarchyQueryFlow<this, TNode, T>;
    Type Parameters
    TNode

    Parameters
    provider
    HierarchyProvider<TNode>

    A HierarchyProvider. Hierarchy

    Returns
    HierarchyQueryFlow<this, TNode, T>

    toJSON()

    Declaration
    toJSON(): T[];
    Returns
    T[]

    toLookup(keySelector, keyEqualer)

    Creates a Lookup for the elements of the Query.

    Declaration
    toLookup<K>(keySelector: (element: T) => K, keyEqualer?: Equaler<K>): Lookup<K, T>;
    Type Parameters
    K

    Parameters
    keySelector
    (element: T) => K

    A callback used to select a key for each element.

    keyEqualer
    Equaler<K>

    An Equaler object used to compare key equality. Scalar

    Returns
    Lookup<K, T>

    toLookup(keySelector, elementSelector, keyEqualer)

    Creates a Lookup for the elements of the Query.

    Declaration
    toLookup<K, V>(keySelector: (element: T) => K, elementSelector: (element: T) => V, keyEqualer?: Equaler<K>): 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) => V

    A callback that selects a value for each element.

    keyEqualer
    Equaler<K>

    An Equaler object used to compare key equality. Scalar

    Returns
    Lookup<K, V>

    toMap(keySelector)

    Creates a Map for the elements of the Query.

    Declaration
    toMap<K>(keySelector: (element: T) => K): Map<K, T>;
    Type Parameters
    K

    Parameters
    keySelector
    (element: T) => K

    A callback used to select a key for each element. Scalar

    Returns
    Map<K, T>

    toMap(keySelector, elementSelector)

    Creates a Map for the elements of the Query.

    Declaration
    toMap<K, V>(keySelector: (element: T) => K, elementSelector: (element: T) => V): 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) => V

    A callback that selects a value for each element. Scalar

    Returns
    Map<K, V>

    toObject(prototype, keySelector)

    Creates an Object for the elements of the Query. 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): 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
    TProto & Record<K, T>

    toObject(prototype, keySelector)

    Creates an Object for the elements of the Query. 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): 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
    TProto & Record<PropertyKey, T>

    toObject(prototype, keySelector)

    Creates an Object for the elements of the Query. 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): Record<K, 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
    Record<K, T>

    toObject(prototype, keySelector)

    Creates an Object for the elements of the Query. 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): Record<PropertyKey, T>;
    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
    Record<PropertyKey, T>

    toObject(prototype, keySelector, elementSelector, descriptorSelector)

    Creates an Object for the elements the Query. 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) => V, descriptorSelector?: (key: K, element: V) => TypedPropertyDescriptor<V>): 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) => 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
    TProto & Record<K, V>

    toObject(prototype, keySelector, elementSelector, descriptorSelector)

    Creates an Object for the elements the Query. 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) => V, descriptorSelector?: (key: PropertyKey, element: V) => TypedPropertyDescriptor<V>): 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) => 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
    TProto & Record<PropertyKey, V>

    toObject(prototype, keySelector, elementSelector, descriptorSelector)

    Creates an Object for the elements the Query. 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) => V, descriptorSelector?: (key: K, element: V) => TypedPropertyDescriptor<V>): 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) => 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
    Record<K, V>

    toObject(prototype, keySelector, elementSelector, descriptorSelector)

    Creates an Object for the elements the Query. 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) => V, descriptorSelector?: (key: PropertyKey, element: V) => TypedPropertyDescriptor<V>): 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) => 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
    Record<PropertyKey, V>

    toObject(prototype, keySelector, elementSelector, descriptorSelector)

    Creates an Object for the elements the Query. 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) => V, descriptorSelector?: (key: PropertyKey, element: V) => PropertyDescriptor): 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) => 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
    object

    toSet()

    Creates a Set for the elements of the Query. Scalar

    Declaration
    toSet(): Set<T>;
    Returns
    Set<T>

    toSet(elementSelector)

    Creates a Set for the elements of the Query.

    Declaration
    toSet<V>(elementSelector: (element: T) => V): Set<V>;
    Type Parameters
    V

    Parameters
    elementSelector
    (element: T) => V

    A callback that selects a value for each element. Scalar

    Returns
    Set<V>

    union(right, equaler)

    Creates a subquery for the set union of this Query and another Iterable.

    Declaration
    union<R extends Iterable<T>>(right: R, equaler?: Equaler<T>): MergeQueryFlow<this, R, T>;
    Type Parameters
    R

    Parameters
    right
    R

    A Iterable object.

    equaler
    Equaler<T>

    An Equaler object used to compare equality. Subquery

    Returns
    MergeQueryFlow<this, R, T>

    union(right, equaler)

    Creates a subquery for the set union of this Query and another Iterable.

    Declaration
    union(right: Iterable<T>, equaler?: Equaler<T>): Query<T>;
    Parameters
    right
    Iterable<T>

    A Iterable object.

    equaler
    Equaler<T>

    An Equaler object used to compare equality. Subquery

    Returns
    Query<T>

    unionBy(right, keySelector, keyEqualer)

    Creates a subquery for the set union of this Query and another Iterable, where set identity is determined by the selected key.

    Declaration
    unionBy<K, R extends Iterable<T>>(right: R, keySelector: (element: T) => K, keyEqualer?: Equaler<K>): MergeQueryFlow<this, R, T>;
    Type Parameters
    K

    R

    Parameters
    right
    R

    A Iterable object.

    keySelector
    (element: T) => K

    A callback used to select the key for each element.

    keyEqualer
    Equaler<K>

    An Equaler object used to compare key equality. Subquery

    Returns
    MergeQueryFlow<this, R, T>

    unionBy(right, keySelector, keyEqualer)

    Creates a subquery for the set union of this Query and another Iterable, where set identity is determined by the selected key.

    Declaration
    unionBy<K>(right: Iterable<T>, keySelector: (element: T) => K, keyEqualer?: Equaler<K>): Query<T>;
    Type Parameters
    K

    Parameters
    right
    Iterable<T>

    A Iterable object.

    keySelector
    (element: T) => K

    A callback used to select the key for each element.

    keyEqualer
    Equaler<K>

    An Equaler object used to compare key equality. Subquery

    Returns
    Query<T>

    unzip()

    Unzips a sequence of tuples into a tuple of sequences.

    Declaration
    unzip(): T extends [any, ...any[]] ? {
            [I in keyof T]: T[I][];
        } : unknown[];
    Returns
    T extends [any, ...any[]] ? { [I in keyof T]: T[I][]; } : unknown[]

    unzip(partSelector)

    Unzips a sequence of tuples into a tuple of sequences.

    Declaration
    unzip<U extends [any, ...any[]]>(partSelector: (value: T) => U): {
            [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
    { [I in keyof U]: U[I][]; }

    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): UnorderedQueryFlow<this, U>;
    Type Parameters
    U

    Parameters
    predicate
    (element: T, offset: number) => element is U

    A callback used to match each element.

    Returns
    UnorderedQueryFlow<this, U>

    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) => boolean): UnorderedQueryFlow<this, T>;
    Parameters
    predicate
    (element: T, offset: number) => boolean

    A callback used to match each element.

    Returns
    UnorderedQueryFlow<this, T>

    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) => boolean): UnorderedQueryFlow<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) => boolean

    A callback used to match each key.

    Returns
    UnorderedQueryFlow<this, T>

    whereDefined()

    Creates a subquery whose elements are neither null nor undefined.

    NOTE: This is an alias for filterDefined.

    Subquery

    Declaration
    whereDefined(): UnorderedQueryFlow<this, NonNullable<T>>;
    Returns
    UnorderedQueryFlow<this, NonNullable<T>>

    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): UnorderedQueryFlow<this, T>;
    Type Parameters
    K

    Parameters
    keySelector
    (element: T) => K

    A callback used to select the key for each element.

    Returns
    UnorderedQueryFlow<this, T>

    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): UnorderedQueryFlow<this, U>;
    Type Parameters
    U

    Parameters
    predicate
    (element: T, offset: number) => element is U

    A callback used to match each element.

    Returns
    UnorderedQueryFlow<this, U>

    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) => boolean): UnorderedQueryFlow<this, T>;
    Parameters
    predicate
    (element: T, offset: number) => boolean

    A callback used to match each element.

    Returns
    UnorderedQueryFlow<this, T>

    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) => boolean): UnorderedQueryFlow<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) => boolean

    A callback used to match each key.

    Returns
    UnorderedQueryFlow<this, T>

    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): UnorderedQueryFlow<this, T>;
    Type Parameters
    K

    Parameters
    keySelector
    (element: T) => K

    A callback used to select the key for each element.

    Returns
    UnorderedQueryFlow<this, T>

    zip(right)

    Creates a subquery that combines this Query with another Iterable by combining elements in tuples.

    Declaration
    zip<U>(right: Iterable<U>): Query<[T, U]>;
    Type Parameters
    U

    Parameters
    right
    Iterable<U>

    A Iterable object. Join

    Returns
    Query<[T, U]>

    zip(right, selector)

    Creates a subquery that combines this Query with another Iterable by combining elements using the supplied callback.

    Declaration
    zip<U, R>(right: Iterable<U>, selector: (left: T, right: U) => R): Query<R>;
    Type Parameters
    U

    R

    Parameters
    right
    Iterable<U>

    A Iterable object.

    selector
    (left: T, right: U) => R

    A callback used to combine two elements. Join

    Returns
    Query<R>

    Generated by DocFX