CommonFindMap
Callable
Type parameters
- Tinp
- Tout
Parameters
array: readonly Tinp[]
The array in question
predicateMapper: (value: Tinp, index: number, obj: readonly Tinp[]) => Tout
A mapping predicate. The first non-nullish return value will be returned by the outer function.
optionalthisArg: any = null
If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.
Returns Tout
- The mapped value or
undefinedif no non-nullish value was found
Take an array and find the first element that maps to a user-specified value, returning the mapped value.
Effectively combines array.find and array.map.