1 | /**
|
2 | * A find options property bag with the selector, thisArg for binding and AbortSignal are all optional.
|
3 | *
|
4 | * @export
|
5 | * @interface OptionalFindOptions
|
6 | * @template T The type of the elements in the source sequence.
|
7 | */
|
8 | export interface OptionalFindOptions<T> {
|
9 | /**
|
10 | * The optional abort signal to be used for cancelling the sequence at any time.
|
11 | *
|
12 | * @type {AbortSignal}
|
13 | * @memberof OptionalFindOptions
|
14 | */
|
15 | signal?: AbortSignal;
|
16 | /**
|
17 | * The optional `this` binding for the predicate function.
|
18 | *
|
19 | * @type {*}
|
20 | * @memberof OptionalFindOptions
|
21 | */
|
22 | thisArg?: any;
|
23 | /**
|
24 | * The optional predicate which gives the current value, the current index and abort signal. This function
|
25 | * returns either a boolean or a promise containing a boolean whether the condition holds or not.
|
26 | *
|
27 | * @memberof OptionalFindOptions
|
28 | */
|
29 | predicate?: (value: T, index: number, signal?: AbortSignal) => boolean | Promise<boolean>;
|
30 | }
|
31 | /**
|
32 | * A find options property bag with the selector being required and the thisArg for binding and AbortSignal are all optional.
|
33 | *
|
34 | * @export
|
35 | * @interface FindOptions
|
36 | * @template T The type of the elements in the source sequence.
|
37 | */
|
38 | export interface FindOptions<T> {
|
39 | /**
|
40 | * The optional abort signal to be used for cancelling the sequence at any time.
|
41 | *
|
42 | * @type {AbortSignal}
|
43 | * @memberof FindOptions
|
44 | */
|
45 | signal?: AbortSignal;
|
46 | /**
|
47 | * The optional `this` binding for the predicate function.
|
48 | *
|
49 | * @type {*}
|
50 | * @memberof FindOptions
|
51 | */
|
52 | thisArg?: any;
|
53 | /**
|
54 | * The optional predicate which gives the current value, the current index and abort signal. This function
|
55 | * returns either a truthy value or a promise containing a truthy value whether the condition holds or not.
|
56 | *
|
57 | * @memberof FindOptions
|
58 | */
|
59 | predicate: (value: T, index: number, signal?: AbortSignal) => boolean | Promise<boolean>;
|
60 | }
|