MCPcopy Create free account
hub / github.com/nodejs/node / findIndex

Function findIndex

test/fixtures/snapshot/typescript.js:524–531  ·  view source on GitHub ↗

Works like Array.prototype.findIndex, returning `-1` if no element satisfying the predicate is found.

(array, predicate, startIndex)

Source from the content-addressed store, hash-verified

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--) {

Callers

nothing calls this directly

Calls 1

predicateFunction · 0.50

Tested by

no test coverage detected