source: frontend/node_modules/underscore/modules/_createPredicateIndexFinder.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 509 bytes
Line 
1import cb from './_cb.js';
2import getLength from './_getLength.js';
3
4// Internal function to generate `_.findIndex` and `_.findLastIndex`.
5export default function createPredicateIndexFinder(dir) {
6 return function(array, predicate, context) {
7 predicate = cb(predicate, context);
8 var length = getLength(array);
9 var index = dir > 0 ? 0 : length - 1;
10 for (; index >= 0 && index < length; index += dir) {
11 if (predicate(array[index], index, array)) return index;
12 }
13 return -1;
14 };
15}
Note: See TracBrowser for help on using the repository browser.