UNPKG

1.37 kBTypeScriptView Raw
1/**
2 * The options for sequence equal operations including a comparer and abort signal
3 *
4 * @interface SequencEqualOptions
5 * @template T The type of items to compare.
6 */
7export interface SequencEqualOptions<T> {
8 /**
9 * The comparer function which returns true if the items are equal, false otherwise.
10 *
11 * @memberof SequencEqualOptions
12 */
13 comparer?: (first: T, second: T) => boolean | Promise<boolean>;
14 /**
15 * An optional abort signal to cancel the operation at any time.
16 *
17 * @type {AbortSignal}
18 * @memberof SequencEqualOptions
19 */
20 signal?: AbortSignal;
21}
22/**
23 * Determines whether two sequences are equal by comparing the elements pairwise.
24 *
25 * @export
26 * @template T The type of the elements in the source sequence.
27 * @param {AsyncIterable<T>} source First async-iterable sequence to compare.
28 * @param {AsyncIterable<T>} other Second async-iterable sequence to compare.
29 * @param {SequencEqualOptions<T>} [options] The sequence equal options which include an optional comparer and optional abort signal.
30 * @returns {Promise<boolean>} A promise which indicates whether both sequences are of equal length and their
31 * corresponding elements are equal.
32 */
33export declare function sequenceEqual<T>(source: AsyncIterable<T>, other: AsyncIterable<T>, options?: SequencEqualOptions<T>): Promise<boolean>;