MCPcopy Index your code
hub / github.com/jashkenas/underscore / createPredicateIndexFinder

Function createPredicateIndexFinder

underscore.js:1277–1287  ·  view source on GitHub ↗
(dir)

Source from the content-addressed store, hash-verified

1275
1276 // Internal function to generate `_.findIndex` and `_.findLastIndex`.
1277 function createPredicateIndexFinder(dir) {
1278 return function(array, predicate, context) {
1279 predicate = cb(predicate, context);
1280 var length = getLength(array);
1281 var index = dir > 0 ? 0 : length - 1;
1282 for (; index >= 0 && index < length; index += dir) {
1283 if (predicate(array[index], index, array)) return index;
1284 }
1285 return -1;
1286 };
1287 }
1288
1289 // Returns the first index on an array-like that passes a truth test.
1290 var findIndex = createPredicateIndexFinder(1);

Callers 1

underscore.jsFile · 0.70

Calls 2

predicateFunction · 0.85
cbFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…