@@ -15,48 +15,78 @@ export default abstract class LinqExtendedBase<T, TLinq extends LinqExtendedBase
1515 * Returns the number of entries in a sequence.
1616 * If a predicate is provided, filters the count based upon the predicate.
1717 * Otherwise counts all the entries in the sequence.
18- * @param {PredicateWithIndex<T> } predicate
18+ * @param {PredicateWithIndex<T> } [ predicate]
1919 * @return {boolean }
2020 */
2121 count ( predicate ?: PredicateWithIndex < T > ) : number ;
2222 /**
23- * Returns true if the predicate ever returns true. Otherwise false.
23+ * Returns true if the predicate ever returns true; otherwise false.
2424 * If no predicate is provided, returns true if the sequence has any entries.
25- * @param {PredicateWithIndex<T> } predicate
25+ * @param {PredicateWithIndex<T> } [ predicate]
2626 * @return {boolean }
2727 */
2828 any ( predicate ?: PredicateWithIndex < T > ) : boolean ;
2929 /**
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]
3232 * @return {boolean }
3333 */
3434 all ( predicate : PredicateWithIndex < T > ) : boolean ;
3535 /**
3636 * Returns the expected single element; otherwise throws an InvalidOperationException.
37+ * @param {PredicateWithIndex<T> } [predicate]
38+ * @return {T }
3739 */
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 ;
3948 /**
4049 * 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 }
4165 */
42- singleOrDefault ( ) : T | undefined ;
43- singleOrDefault ( defaultValue : T ) : T ;
66+ firstOrDefault ( defaultValue : T , predicate ?: PredicateWithIndex < T > ) : T ;
4467 /**
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 }
4671 */
47- first ( ) : T ;
72+ firstOrUndefined ( predicate ?: PredicateWithIndex < T > ) : T | undefined ;
4873 /**
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 }
5077 */
51- firstOrDefault ( ) : T | undefined ;
52- firstOrDefault ( defaultValue : T ) : T ;
78+ last ( predicate ?: PredicateWithIndex < T > ) : T ;
5379 /**
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 }
5584 */
56- last ( ) : T ;
85+ lastOrDefault ( defaultValue : T , predicate ?: PredicateWithIndex < T > ) : T ;
5786 /**
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 }
5990 */
60- lastOrDefault ( ) : T | undefined ;
61- lastOrDefault ( defaultValue : T ) : T ;
91+ lastOrUndefined ( predicate ?: PredicateWithIndex < T > ) : T | undefined ;
6292}
0 commit comments