@@ -15,48 +15,78 @@ export default abstract class LinqExtendedBase<T, TLinq extends LinqExtendedBase
15
15
* Returns the number of entries in a sequence.
16
16
* If a predicate is provided, filters the count based upon the predicate.
17
17
* Otherwise counts all the entries in the sequence.
18
- * @param {PredicateWithIndex<T> } predicate
18
+ * @param {PredicateWithIndex<T> } [ predicate]
19
19
* @return {boolean }
20
20
*/
21
21
count ( predicate ?: PredicateWithIndex < T > ) : number ;
22
22
/**
23
- * Returns true if the predicate ever returns true. Otherwise false.
23
+ * Returns true if the predicate ever returns true; otherwise false.
24
24
* If no predicate is provided, returns true if the sequence has any entries.
25
- * @param {PredicateWithIndex<T> } predicate
25
+ * @param {PredicateWithIndex<T> } [ predicate]
26
26
* @return {boolean }
27
27
*/
28
28
any ( predicate ?: PredicateWithIndex < T > ) : boolean ;
29
29
/**
30
- * Returns false if the predicate ever returns false. Otherwise true.
31
- * @param {PredicateWithIndex<T> } predicate
30
+ * Returns false if the predicate ever returns false; otherwise true.
31
+ * @param {PredicateWithIndex<T> } [ predicate]
32
32
* @return {boolean }
33
33
*/
34
34
all ( predicate : PredicateWithIndex < T > ) : boolean ;
35
35
/**
36
36
* Returns the expected single element; otherwise throws an InvalidOperationException.
37
+ * @param {PredicateWithIndex<T> } [predicate]
38
+ * @return {T }
37
39
*/
38
- single ( ) : T ;
40
+ single ( predicate ?: PredicateWithIndex < T > ) : T ;
41
+ /**
42
+ * Returns the expected single element; otherwise the provided default value.
43
+ * @param {T } defaultValue
44
+ * @param {PredicateWithIndex<T> } [predicate]
45
+ * @return {T }
46
+ */
47
+ singleOrDefault ( defaultValue : T , predicate ?: PredicateWithIndex < T > ) : T ;
39
48
/**
40
49
* Returns the expected single element; otherwise undefined.
50
+ * @param {PredicateWithIndex<T> } [predicate]
51
+ * @return {T | undefined }
52
+ */
53
+ singleOrUndefined ( predicate ?: PredicateWithIndex < T > ) : T | undefined ;
54
+ /**
55
+ * Returns the first element of the sequence.
56
+ * @param {PredicateWithIndex<T> } [predicate]
57
+ * @return {T }
58
+ */
59
+ first ( predicate ?: PredicateWithIndex < T > ) : T ;
60
+ /**
61
+ * Returns the first element of the sequence or the default value if no element is found.
62
+ * @param {T } defaultValue
63
+ * @param {PredicateWithIndex<T> } [predicate]
64
+ * @return {T }
41
65
*/
42
- singleOrDefault ( ) : T | undefined ;
43
- singleOrDefault ( defaultValue : T ) : T ;
66
+ firstOrDefault ( defaultValue : T , predicate ?: PredicateWithIndex < T > ) : T ;
44
67
/**
45
- * Returns the first element of a sequence.
68
+ * Returns the first element of the sequence; otherwise undefined.
69
+ * @param {PredicateWithIndex<T> } [predicate]
70
+ * @return {T | undefined }
46
71
*/
47
- first ( ) : T ;
72
+ firstOrUndefined ( predicate ?: PredicateWithIndex < T > ) : T | undefined ;
48
73
/**
49
- * Returns the first element of a sequence or the default value if no element is found.
74
+ * Returns the last element of the sequence.
75
+ * @param {PredicateWithIndex<T> } [predicate]
76
+ * @return {T }
50
77
*/
51
- firstOrDefault ( ) : T | undefined ;
52
- firstOrDefault ( defaultValue : T ) : T ;
78
+ last ( predicate ?: PredicateWithIndex < T > ) : T ;
53
79
/**
54
- * Returns the last element of a sequence.
80
+ * Returns the last element of the sequence or the default value if no element is found.
81
+ * @param {T } defaultValue
82
+ * @param {PredicateWithIndex<T> } [predicate]
83
+ * @return {T }
55
84
*/
56
- last ( ) : T ;
85
+ lastOrDefault ( defaultValue : T , predicate ?: PredicateWithIndex < T > ) : T ;
57
86
/**
58
- * Returns the first element of a sequence or the default value if no element is found.
87
+ * Returns the last element of the sequence; otherwise undefined.
88
+ * @param {PredicateWithIndex<T> } [predicate]
89
+ * @return {T | undefined }
59
90
*/
60
- lastOrDefault ( ) : T | undefined ;
61
- lastOrDefault ( defaultValue : T ) : T ;
91
+ lastOrUndefined ( predicate ?: PredicateWithIndex < T > ) : T | undefined ;
62
92
}
0 commit comments