source: frontend/node_modules/underscore/amd/_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: 558 bytes
Line 
1define(['./_cb', './_getLength'], function (_cb, _getLength) {
2
3 // Internal function to generate `_.findIndex` and `_.findLastIndex`.
4 function createPredicateIndexFinder(dir) {
5 return function(array, predicate, context) {
6 predicate = _cb(predicate, context);
7 var length = _getLength(array);
8 var index = dir > 0 ? 0 : length - 1;
9 for (; index >= 0 && index < length; index += dir) {
10 if (predicate(array[index], index, array)) return index;
11 }
12 return -1;
13 };
14 }
15
16 return createPredicateIndexFinder;
17
18});
Note: See TracBrowser for help on using the repository browser.