rc-js-util
Version:
A collection of TS and C++ utilities to help writing performant and correct applications, achieved through strict typing and (removable) invariant checking.
70 lines (33 loc) • 1.41 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [rc-js-util](./rc-js-util.md) > [ATypedArrayTuple](./rc-js-util.atypedarraytuple.md) > [findIndex](./rc-js-util.atypedarraytuple.findindex.md)
## ATypedArrayTuple.findIndex() method
Returns the index of the first element in the array where predicate is true, and -1 otherwise.
**Signature:**
```typescript
findIndex(_predicate: (value: number, index: TExtractIndexes<this>, obj: this) => boolean, _thisArg?: unknown): number;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
\_predicate
</td><td>
(value: number, index: [TExtractIndexes](./rc-js-util.textractindexes.md)<!-- --><this>, obj: this) => boolean
</td><td>
find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, findIndex immediately returns that element index. Otherwise, findIndex returns -1.
</td></tr>
<tr><td>
\_thisArg
</td><td>
unknown
</td><td>
_(Optional)_ If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.
</td></tr>
</tbody></table>
**Returns:**
number