MCPcopy Create free account
hub / github.com/TruthHun/BookStack / createPredicateIndexFinder

Function createPredicateIndexFinder

static/word2md/mammoth.browser.js:28470–28480  ·  view source on GitHub ↗
(dir)

Source from the content-addressed store, hash-verified

28468
28469 // Generator function to create the findIndex and findLastIndex functions
28470 function createPredicateIndexFinder(dir) {
28471 return function(array, predicate, context) {
28472 predicate = cb(predicate, context);
28473 var length = getLength(array);
28474 var index = dir > 0 ? 0 : length - 1;
28475 for (; index >= 0 && index < length; index += dir) {
28476 if (predicate(array[index], index, array)) return index;
28477 }
28478 return -1;
28479 };
28480 }
28481
28482 // Returns the first index on an array-like that passes a predicate test
28483 _.findIndex = createPredicateIndexFinder(1);

Callers 1

mammoth.browser.jsFile · 0.70

Calls 1

cbFunction · 0.70

Tested by

no test coverage detected