- satisfies<T>(index: number, condition: ((x: T) => boolean)): ((arr: readonly T[]) => boolean)
-
Parameters
-
index: number
-
condition: ((x: T) => boolean)
-
- (x: T): boolean
-
Returns boolean
Returns ((arr: readonly T[]) => boolean)
-
- (arr: readonly T[]): boolean
-
Returns boolean
Returns
true
if the array element atindex
exists and satisfiescondition
. Negative indices count backwards from the end of the array.Remarks
This function is designed to improve developer experience by eliminating the need to account for the
undefined
type when accessing an array element.Example