MCPcopy Create free account
hub / github.com/dtmilano/AndroidViewClient / createPredicateIndexFinder

Function createPredicateIndexFinder

docs/_static/underscore-1.13.1.js:1242–1252  ·  view source on GitHub ↗
(dir)

Source from the content-addressed store, hash-verified

1240
1241 // Internal function to generate `_.findIndex` and `_.findLastIndex`.
1242 function createPredicateIndexFinder(dir) {
1243 return function(array, predicate, context) {
1244 predicate = cb(predicate, context);
1245 var length = getLength(array);
1246 var index = dir > 0 ? 0 : length - 1;
1247 for (; index >= 0 && index < length; index += dir) {
1248 if (predicate(array[index], index, array)) return index;
1249 }
1250 return -1;
1251 };
1252 }
1253
1254 // Returns the first index on an array-like that passes a truth test.
1255 var findIndex = createPredicateIndexFinder(1);

Callers 1

Calls 1

cbFunction · 0.85

Tested by

no test coverage detected