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