Works like Array.prototype.findIndex, returning `-1` if no element satisfying the predicate is found.
(array, predicate, startIndex)
| 522 | ts.findLast = findLast; |
| 523 | /** Works like Array.prototype.findIndex, returning `-1` if no element satisfying the predicate is found. */ |
| 524 | function findIndex(array, predicate, startIndex) { |
| 525 | for (var i = startIndex || 0; i < array.length; i++) { |
| 526 | if (predicate(array[i], i)) { |
| 527 | return i; |
| 528 | } |
| 529 | } |
| 530 | return -1; |
| 531 | } |
| 532 | ts.findIndex = findIndex; |
| 533 | function findLastIndex(array, predicate, startIndex) { |
| 534 | for (var i = startIndex === undefined ? array.length - 1 : startIndex; i >= 0; i--) { |
nothing calls this directly
no test coverage detected